XML Webservice Option
With JobsGoLocal XML Webservice Option php sent the return value is a string containing XML formatted list of jobs from the offices you stipulated.
Example call:
/?offices=GUF|WOA&format=xml
This service is ideal for use either following some kind of transformation or reformatting on your server, but can also be used directly on the client perhaps with a Javascript library like jQuery.
You should only call this service once a day and cache the file locally.
Format:
Sample code (using PHP and its simpleXML class)
<?php
$xml = file_get_contents( 'yourcache.xml' );
$jobs = new SimpleXMLElement($xml);
if( $jobs->zero ){
echo $jobs->zero ;
}else{
foreach ($jobs->job as $j) {
echo $j->title. ' at ' . $j->officecode . '</p>'; // NB underscore removed in xml feeds!
echo '<p>' . $j->reference . '</p>' ;
echo '<p>' . $j->location . '</p>' ;
}
}
?>
Errors:
If you make a fundamental mistake in the call, when testing for example, you will get a simple string telling you what was wrong.
"You failed to submit any jobcentreplus office codes"
If there are no jobs at all matching the call you submitted either because the office code(s) were not found in the parent .csv file or because there were simply no jobs (which can happen on Sunday and Monday mornings) you will get an array whose first element is named "zero", and you should check for its existence in order to be able to at least degrade to a reasonable message, and carry on.
Otherwise any other error will cause this XML formatted string to appear:
Headers:
The headers accompanying the response for this format will be:
Cache-Control: no-cache, must-revalidate
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Content-Type:text/xml; charset=utf=8