0
我想在我的WordPress的網站使用谷歌飼料API。我已經啓用了一個插件的PHP,它允許我在我的頁面中輸入PHP代碼。我的託管服務提供商也確認他們已啓用curl。谷歌飼料api不返回結果與WordPress在WordPress
這是IAM試圖運行這是我從谷歌開發者網站 (https://developers.google.com/feed/v1/jsondevguide#basic_query)
<?php
$url = "https://ajax.googleapis.com/ajax/services/feed/find?v=1.0&q=iphone5& userip=2.96.214.41";
// sendRequest
// note how referer is set manually
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, http://www.iweb21.com);
$body = curl_exec($ch);
curl_close($ch);
// now, process the JSON string
$json = json_decode($body);
// now have some fun with the results...
?>
我沒有得到任何結果,只是一個空白頁面得到的代碼。
我不是一個php程序員。只是一個新手WordPress用戶。我一直在尋找一個插件來使用谷歌飼料API,但無處可尋。所以我決定嘗試使用谷歌提供的代碼。
我會非常感激任何意見。 thnx