phpgurl Posted September 2, 2007 Share Posted September 2, 2007 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 More sharing options...
dsaba Posted September 22, 2007 Share Posted September 22, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.