doubi6669 2017-03-30 21:02
浏览 73
已采纳

Yelp Fusion API - 使用PHP和JSON提取特定业务数据

I'm trying to figure out how to use the Yelp Fusion API with PHP to return the Yelp rating and location for a specific business.

I've looked for a code sample for the Yelp Fusion Business API in action, but I can't find one. I did find an example for the Yelp Fusion Search API (https://github.com/Yelp/yelp-fusion/blob/master/fusion/php/sample.php), but I'm not a developer and I'm struggling modifying it to work for my needs.

Can someone please show me how to develop a php file that will get the business data for a specific business (pick anyone or use the-crack-shack-encinitas) and how to echo these individual pieces of data (ratings and location)?

Thank you for your time and assistance.

Todd

High School Web Design Teacher and Life Long Learner

Documentation

https://www.yelp.com/developers/documentation/v3/business

  • 写回答

3条回答 默认 最新

  • douyanlu7380 2017-04-06 18:06
    关注

    I was able to get help on the Yelp GitHub Page https://github.com/Yelp/yelp-fusion/issues/202

    Below is the solution I cam up with and it works.

    $arr = json_decode($pretty_response);
    echo "Rating is - " . $arr->rating . "<br>" . "Address<br>" . $arr->location->display_address[0] . "<br>" . $arr->location->display_address[1];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?