August 11, 2016 7:41 am

Create a job searching page in PHP with Indeed APIs

We have created a job searching page on PHPGang here where you can search jobs and its powered by Indeed APIs and PHP. Today I am publishing that code and page with my readers so you can easily create job searching and you can earn from there affiliation.

Create a job searching in PHP with Indeed APIs

[wpdm_file id=177]DEMO

Account creation and integration:

Step 1. Create your publisher account click here and you will get your publisher id.

XML Job Search Feed Indeed Publisher

Step 2. Coding

Below code show you list of 10 jobs available on your given data.

<?php
require 'indeed.php'; // indeed library
$client = new Indeed("Your-Indeed-Publisher-ID");


    $params = array(
        "v" => "2",     // API Version
        "q" => "PHP",  //Job Title
        "l" => "Pakistan", // Country Name default 'United States'
        "co" => "PK",      // Country Code defauld US
        "userip" => $_SERVER['REMOTE_ADDR'], // Your IP Address
        "useragent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2)"    // user agent
    );
    $results = $client->search($params);   // API Call for results

    if($results['totalResults'] <=0)
    {
        echo "<h3>Nothing Found!!</h3>";
    }
    else
    {
        echo "<h3><b>PHP jobs in Pakistan</b></h3><br>";
    }
    echo "<table border=1>
    <tr>
        <th>Date</th>
        <th>Title</th>
        <th>Location</th>
        <th>Description</th>
    <tr>";
    for($i=0;$i<count($results['results']);$i++)
    {
        echo "
        <tr>
            <td>".$results['results'][$i]['date']."</td>
            <td><a href='?jdetails=".$results['results'][$i]['jobkey']."' target='_blank'>".$results['results'][$i]['jobtitle']."</a></td>
            <td>".$results['results'][$i]['formattedLocation'].", ".$results['results'][$i]['country']."</td>
            <td>".$results['results'][$i]['snippet']."</td>
        </tr>";
    }
    echo "</table>";
?>

This code get PHP jobs in Pakistan and show you 10 available records included indeed.php file attached in download code.

How to view a job:

This code will do that work for you.

<?php
require 'indeed.php';  // indeed library
$client = new Indeed("Your-Indeed-Publisher-ID");

if(isset($_GET['jdetails']))// Job Details
{
    $key = $_GET['jdetails'];

    $params = array("jobkeys" => array($key),);
    $result = $client->jobs($params);
                            
    $job_title = $result['results'][0]['jobtitle'];
    $job_location = $result['results'][0]['city'];
    echo "<table border=1>
    <tr>
        <th>Posted</th>
        <th>Title</th>
        <th>City</th>
        <th>Description</th>
        <th>Company</th>
    <tr>";
    echo "
        <tr>
            <td>".$result['results'][0]['formattedRelativeTime']."</td>
            <td>".$result['results'][0]['jobtitle']."</td>
            <td>".$result['results'][0]['city']."</td>
            <td>".$result['results'][0]['snippet']."</td>
            <td>".$result['results'][0]['company']."</td>
        </tr>";
    echo "</table>";
}
?>

Code above show details of a job by job key.

That’s it.

I hope you like this tutorial and please make your job search pages and share link below and if you face any problem please feel free to comment your problem we will try to solve it asap.

Author Huzoor Bux

I am Huzoor Bux from Karachi (Pakistan). I have been working as a PHP Developer from last 5+ years, and its my passion to learn new things and implement them as a practice. Basically I am a PHP developer but now days exploring more in HTML5, CSS and jQuery libraries.


Tutorial Categories:

5 responses to “Create a job searching page in PHP with Indeed APIs”

  1. great tutorial. can you please send or share the full code including the css like in your demo job page. please?

  2. Dave says:

    implementing the code is quite confusing, could you please provide full code. thanks

  3. Nagarjun Bandaru says:

    Hi

    Our client
    is looking for PHP
    Developer(75% remote). If you are interested please
    send me your updated resume along with visa status and current/expecting
    salary

    Role: PHP Developer (75% remote)

    Location: Hoover, AL

    Possibility of remote with 1-2 days onsite weekly

    Requirement:

    Candidate must have
    experience with web development (PHP, CSS, JQuery, and AJAX) and programming in
    codeignitor environment is a plus.

    Proven experience programming
    in PHP, CSS, JavaScript, JQuery and AJAX

    Proven knowledge of SQL environment and SQL
    statements

    PHP, CSS, MySQI, JQuery, and
    AJAX programming in codeignitor environment is a plus.

    At least 4 years experience
    is desirable.

    Thanks & Regards:-

    Name: Nagarjun Bandaru

    Email id: [email protected]

  4. Francis says:

    Hello
    How to exceed limit 25?
    Otherwise it works great.
    Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *