Jump to content

Recommended Posts

If I have a form using the _POST method, and I've asked for a zipcode...  saved into a variable $zipcode, how would I go about putting that variable into a request to Yahoo Local Search API - such that that zipcode is replaced in

http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=YahooDemo&query=pizza&zip=94306&results=2

 

And then, do I continue with the same file to handle / manipulate the results? This confuses me because if I put that URL in the browser, I get back some xml - right in the browser.  That's not what I want my visitor to see.  I think I need the next step - or some explanation of what happens.  I do have the developer page http://developer.yahoo.com/search/local/V3/localSearch.html and I'm reading it as best I can, but it seems I fail to grasp how to move forward.  I don't need complete code - just an outline or direction of where to take this.  (I'd like to put the results into a map - either Yahoo or Google).  I'm getting a bit dizzy with all the different methods offered on many sites and no one of them has actually explained what I think is fairly do-able.

Link to comment
https://forums.phpfreaks.com/topic/67629-basic-php-for-noobie/
Share on other sites

  • 3 weeks later...

file_get_contents() retrieves the source of files/webpages thus loading the page, you can send the variable by concactenatin it in teh url

 

$zip = '23445';

$raw = file_get_contents('http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=YahooDemo&query=pizza&zip='.$zip.'&results=2');

 

//raw is the html source or source of whatever you grab with file_get_contents()

you can use string manipulation to loop, use regex to grab whatever you need from the source, like search results.. etc....

 

good luck

Link to comment
https://forums.phpfreaks.com/topic/67629-basic-php-for-noobie/#findComment-352750
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.