嗨所以我創建使用Foursquare的API在某一領域的趨勢地點清單從Foursquare的API趨勢列表:請參見以下鏈接http://createmate.co/foursquare-whatshot/如何將鏈接添加到什麼使用PHP
我試圖找出如何讓每個項目鏈接到其各自的Foursquare網址。這裏是到目前爲止的代碼...
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Foursquare What's Hot</title>
<!-- external CSS link -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="container">
<h1>Foursquare What's Hot</h1>
<?php
/* GET THE DATA */
$trending_url = file_get_contents("https://api.foursquare.com/v2/venues/trending?ll=40.7,-74&oauth_token=BQEPEMYIFHHH2C1OGBTJDI4GBYV5HQAPNFLR5ON1JIAI42GN&v=20130220");
$trending_output = json_decode($trending_url);
/* TEST THE DATA */
//echo "<pre>";
//print_r($trending_output);
//echo "</pre>";
/* PRINT RESULTS */
for ($i=0;$i<10;$i++) {
echo "<ul id ='locations'>";
echo "<li> <a href= " . $trending_output->response->venues[$i]->canonicalURL . "> <h3>" . $trending_output->response->venues[$i]->name . "<br>";
echo "<li> <h4>" . $trending_output->response->venues[$i]->location->address . "<br>";
echo "</ul>";
}
?>
</div>
</body>
任何幫助深表感謝。
亞當
你可以粘貼'print_r($ trending_output);'的輸出給我們嗎? – mkaatman 2013-02-27 19:37:12