Reputation: 79
I've been all over the web and its pretty unclear to me how to get the yelp api to work using the php code sample provided.
So far I have
Grabbed the sample php file from here https://raw.githubusercontent.com/Yelp/yelp-api/master/v2/php/sample.php
I have not modified this file at all except to add my authentication.
Gotten all of my tokens,keys and secrets
$CONSUMER_KEY = "GOT IT!";
$CONSUMER_SECRET = "GOT IT!";
$TOKEN = "GOT IT!";
$TOKEN_SECRET = "GOT IT!";
I am including the OAuth, which I got from here http://oauth.googlecode.com/svn/code/php/
require_once('OAuth.php');
In the read me document it states to simply go to the php file and check out the results
When I visit the page on my site, I get this error message(I removed my actual consumer key)
0 businesses found, querying business info for the top result "" Result for business "" found: {"error": {"text": "Signature was invalid", "id": "INVALID_SIGNATURE", "description": "Invalid signature. Expected signature base string: GET\u0026http%3A%2F%2Fapi.yelp.com%2Fv2%2Fbusiness%2F\u0026oauth_consumer_key%KEY%26oauth_nonce%3Db7869743b1599850a2db6e92fc2a6239%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1414090806%26oauth_token%3DyJMyLRsFiAIuKSuclV1d6pb0pwjwiEat%26oauth_version%3D1.0"}}
I just signed up for the api keys today and have checked and double checked and they are correct in the php file.
I've also attempted to add parameters to the url to see if I can get any results and its always the same error.
My end goal is to pull in all reviews for a business by using its phone number as a search parameter. If anyone can provide an example of how I would pass the parameter that would be so helpful too.
Upvotes: 0
Views: 1632
Reputation: 560
To get yelp business details using phone number:
You can try a http or curl request to
http://api.yelp.com/phone_search?phone=8009773609&ywsid=sQ3g4WLACeGWOFXXXXXXXX
ywsid = Yelp CONSUMER_KEY
Upvotes: 0
Reputation: 107
After getting and placing the token and secret from the app you created on Yelp. You have to edit one more thing in Sample.php
on 13th last line (or line:138) you will see the following:
`$longopts = array(
"term:: /* Place Term here e.g. 'Bars' */ ",
"location:: /* Place Location here e.g. 'San Francisco, CA' */ ",
);`
Or the location can be change from your Yelp Developer ID by editing the location.
Hope you got the answer.
Upvotes: 0