University of Cambridge

Job Opportunities

List of categories

Example

The following will output a list of all the category names in PHP:

<?php

$results = @file_get_contents("https://www.jobs.cam.ac.uk/?format=json");

if($results) {
    $results = json_decode($results);
    if(isset($results->lists) && count($results->lists) > 0) {
        echo "<ul>\n";
        foreach($results->lists as $list) {
            echo "<li>".$list->name." (".$list->jobs." listed)</li>\n";
        }
        echo "</ul>\n";
    } else {
        echo "<p>No categories.</p>\n";
    }
} else {
    echo "<p>Unable to load categories.</p>\n";
}