Created
June 23, 2014 22:44
-
-
Save drrobotnik/009b46f23c7b274974bb to your computer and use it in GitHub Desktop.
sdrock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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