Anyway, I went ahead and updated the original script to reflect what all the contributors indicated as bugs along with replacing the HTTP stuff with WWW class. To my knowledge this is the most up to date OauthBase script.
Anyway, I feel that I’m razor thin of getting it to work but I’m getting the follow Error - “INVALID_SIGNATURE”, “description”: “Invalid signature. Expected signature base string: GET\u…”
It’s clearly an issue with the the generation method, just can’t figure it out/troubleshoot it. I would definitely appreciate some feedback, and please feel free to try it out yourself. Just bring the scripts into your project, slap the “Yelp_BasicSearch.cs” script to any gameobject in your scene, and run the scene. It’ll print out results in the console and as a text file on your desktop . You may need to do a quick Yelp Dev signup to get keys/tokens to test it- https://www.yelp.com/developers/api_console
Gambit_for_hire you are a huge lifesaver, I swear man:hushed:.
Your code hit it right on the money$$$$. I used about 98% of it to get yelp to work.
I really only made updates to 4 areas of your code.
SearchTwitter_Coroutine Function - I changed the key value parameter pairs to {“term”,“food”},{“location”,[WWW.escapeurl(](http://WWW.escapeurl()“San Francisco, ca”)} - clearly as a basic search run.
CreateAuthorizationHeaderParameter Function - I reordered the Authorization header parameters to follow suite with the order indicated in the the Oauth.net spec - OAuth Core 1.0a
Gambit_for_hire -Not a problem. I’m new to git and just signed up the other day. I’ll create a repository and notify you when I get a chance. Do you have a git username so I can throw you props.
@OJ3D Thanks for sharing your snippet! Works awesome. I’ve got a search that brings me the best rated places in my area.
This is my first time dabbling in all of the above (Oauth, WWW requests, JSON) What do you do with the results of the search? I’d like to filter out all the names and URLs of the restaurants in the results and pass them into clickable buttons.
What are the words and methods that I should be researching to accomplish this?
Bridin - Glad it works.
What you essentially receive is text that is structured in a JSON format. In order to read what you need, use SimpleJSON to parse the text file (Node) into a usable array - http://wiki.unity3d.com/index.php/SimpleJSON. Then create a loop routine to parse out what you need.
And now I get the console to tell me that it has regions, totals and businesses. I believe that means that I have found the key? Now I just need to take it a step further and get the business names from the key? Maybe?
I don’t know anything about the key stuff. I looked into that link, I didn’t mess around with that stuff. Look at the SimpleJSON example scenes and the c# code. That’s how I got things to work.
it’s something along the lines like this:
//ReadYelpJSON is the www.text you recieved–i.e the JSON node
JSONArray yelpitems = (JSONArray)ReadYelpJSON["businesses"]; //<--you'll see the businesses is the top most node in the JSON text
int YelpArrayLength = yelpitems.Count; //for loop routines
//Initialize arrays of interest
string [] ParsedMobileUrlText = new string[YelpArrayLength];
string [] ParsedRatingText = new string[YelpArrayLength];
//Define the Arrays
for (int i = 0; i < YelpArrayLength; i++)
{
ParsedMobileUrlText=ReadYelpJSON ["businesses"] ["mobile_url"];
ParsedRatingText=ReadYelpJSON ["businesses"] ["rating"];
}
//Wallah!Usable arrays are now defined
Also, if you’re confused on the structure of a JSON node, use this tool (http://jsonviewer.stack.hu/) it’s f-in! awesome. Just slap the text you receive, paste it and it’ll show you the break down of the JSON node