Return to Snippet

Revision: 9718
at November 18, 2008 17:15 by jamesming


Updated Code
$yelpstring = file_get_contents("http://api.yelp.com/business_review_search?category=bars&lat=".$latitude."&long=".$longitude."&radius=25&num_biz_requested=100&ywsid=<your yelp account id>", true); 

$obj = json_decode($yelpstring);// Convert JSON from yelp return string


	foreach($obj->businesses as $business):
	    echo "<img border=0 src='".$business->photo_url."'><br/>";
	    echo $business->name."<br/>";
	    echo $business->address1."<br/>";
	    
	    if( $business->address2 ){
	    	 echo $business->address2."<br/>";
	    };
	    
	    echo $business->city ."<br/>";
	    echo $business->state ."<br/>";
	    echo $business->zip ."<br/>";
	    echo $business->latitude ."<br/>";
	    echo $business->longitude ."<br/>";

	    echo "<hr>";
	endforeach;

Revision: 9717
at November 18, 2008 17:03 by jamesming


Initial Code
$yelpstring = file_get_contents("http://api.yelp.com/business_review_search?term=cafes&lat=".$latitude."&long=".$longitude."&radius=25&num_biz_requested=100&ywsid=<your yelp account id>", true); 

$obj = json_decode($yelpstring);// Convert JSON from yelp return string


	foreach($obj->businesses as $business):
	    echo "<img border=0 src='".$business->photo_url."'><br/>";
	    echo $business->name."<br/>";
	    echo $business->address1."<br/>";
	    
	    if( $business->address2 ){
	    	 echo $business->address2."<br/>";
	    };
	    
	    echo $business->city ."<br/>";
	    echo $business->state ."<br/>";
	    echo $business->zip ."<br/>";
	    echo $business->latitude ."<br/>";
	    echo $business->longitude ."<br/>";

	    echo "<hr>";
	endforeach;

Initial URL
http://groups.google.com/group/yelp-developer-support/browse_thread/thread/d52aa7033b3e7dbd#

Initial Description
Also check out...

http://roshanbh.com.np/2008/10/creating-parsing-json-data-php.html

Initial Title
Parse  JSON from YELP API

Initial Tags
json

Initial Language
PHP