PHP interface to Careerjet's public search API
Here is a easy-to-use PHP module to embed Careerjet job search results into your website.
Installation
If you use a pre-5.2 version of PHP, you need to install json with the following command
pear install json
Make sure your php.ini contains the line
extension=json.so
Otherwise, all you need to do is download Careerjet_API.zip and unzip it in a location where your scripts will find it:
cd my_application_directory wget http://www.careerjet.co.uk/partners/api/php/Careerjet_API.zip unzip Careerjet_API.zip
Documentation
For full details please refer to the documentation in the Careerjet_API.php script contained within the .zip archive.
Example script
<?php require_once "Careerjet_API.php" ; $api = new Careerjet_API('en_GB') ; $page = 1 ; # Or from parameters. $result = $api->search(array( 'keywords' => 'php developer', 'location' => 'London', 'page' => $page , 'affid' => '678bdee048', )); if ( $result->type == 'JOBS' ){ echo "Found ".$result->hits." jobs" ; echo " on ".$result->pages." pages\n" ; $jobs = $result->jobs ; foreach( $jobs as $job ){ echo " URL: ".$job->url."\n" ; echo " TITLE: ".$job->title."\n" ; echo " LOC: ".$job->locations."\n"; echo " COMPANY: ".$job->company."\n" ; echo " SALARY: ".$job->salary."\n" ; echo " DATE: ".$job->date."\n" ; echo " DESC: ".$job->description."\n" ; echo "\n" ; } # Basic paging code if( $page > 1 ){ echo "Use \$page - 1 to link to previous page\n"; } echo "You are on page $page\n" ; if ( $page < $result->pages ){ echo "Use \$page + 1 to link to next page\n" ; } } # When location is ambiguous if ( $result->type == 'LOCATIONS' ){ $locations = $result->solveLocations ; foreach ( $locations as $loc ){ echo $loc->name."\n" ; # For end user display ## Use $loc->location_id when making next search call ## as 'location_id' parameter } } ?>