Function Reference: gdfi_yelp_example
Summary
This function has not been documented yet.
Source Code
function gdfi_yelp_example() { // For example, request business with id 'the-waterboy-sacramento' $unsigned_url = "http://api.yelp.com/v2/business/the-waterboy-sacramento"; global $wpdb; $gdfi_config_yelp = get_option('gdfi_config_yelp'); // Set your keys here $consumer_key = $gdfi_config_yelp['key']; $consumer_secret = $gdfi_config_yelp['key_secret']; $token = $gdfi_config_yelp['token']; $token_secret = $gdfi_config_yelp['token_secret']; // Token object built using the OAuth library $token = new GeodirYelpAuthToken($token, $token_secret); // Consumer object built using the OAuth library $consumer = new GeodirYelpAuthConsumer($consumer_key, $consumer_secret); // Yelp uses HMAC SHA1 encoding $signature_method = new GeodirYelpAuthSignatureMethod_HMAC_SHA1(); // Build OAuth Request using the OAuth PHP library. Uses the consumer and token object created above. $oauthrequest = GeodirYelpAuthRequest::from_consumer_and_token($consumer, $token, 'GET', $unsigned_url); // Sign the request $oauthrequest->sign_request($signature_method, $consumer, $token); // Get the signed URL $signed_url = $oauthrequest->to_url(); // Send Yelp API Call $ch = curl_init($signed_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); $data = curl_exec($ch); // Yelp response curl_close($ch); // Handle Yelp response data $response = json_decode($data); // Print it for debugging print_r($response); }