Skip to content

Instantly share code, notes, and snippets.

@drrobotnik
Created June 23, 2014 22:44
Show Gist options
  • Save drrobotnik/009b46f23c7b274974bb to your computer and use it in GitHub Desktop.
Save drrobotnik/009b46f23c7b274974bb to your computer and use it in GitHub Desktop.
sdrock
if ( false === ( $result = get_transient( 'sdrock_jobs' ) ) ) {
// It wasn't there, so regenerate the data and save the transient
$result = wp_remote_get( 'http://www.sdrock.com/mobileapp/ajax/job_list_items/?organization=academy' );
$code = wp_remote_retrieve_response_code( $result );
$body = wp_remote_retrieve_body( $result );
if( $code != 200 ){
return false;
}else{
$result = $body;
set_transient( 'sdrock_jobs', $body, HOUR_IN_SECONDS );
}
}
$jobs = json_decode($result);
//var_dump($jobs->items);
foreach ($jobs->items as $item) {
var_dump($item->title);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment