雅虎导入联系人通过yql给出错误

时间:2015-07-29 10:56:59

标签: php import contacts yahoo

我试图在YQL的帮助下导入雅虎联系人,但遇到了问题。 我正在使用此链接上的方法https://developer.yahoo.com/yql/guide/yql-code-examples.html#yql_php

但我收到了这个错误:

  

{“error”:{“lang”:“en-US”,“description”:“身份验证错误。表social.contacts需要比提供的更高的安全级别,您提供任何但至少USER应该是“}}

我错过了什么 我已经在yql控制台上运行了这个查询,显示了结果,但是得到的结果直接打到url或curl。

我的代码是:

$BASE_URL = "https://query.yahooapis.com/v1/public/yql";

// Form YQL query and build URI to YQL Web service
$yql_query = "select * from social.contacts(0, 500) where guid=me";
$yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&format=json";

// Make call with cURL
$session = curl_init($yql_query_url);
curl_setopt($session, CURLOPT_RETURNTRANSFER,true);
$json = curl_exec($session);
// Convert JSON to PHP object 
$phpObj =  json_decode($json);


// Confirm that results were returned before parsing
if(!is_null($phpObj->query->results)){
  // Parse results and extract data to display
  foreach($phpObj->query->results->event as $event){
                $events .= "<div><h2>" . $event->name . "</h2><p>";
                $events .= html_entity_decode(wordwrap($event->description, 80, "<br/>"));
                $events .="</p><br/>$event->venue_name<br/>$event->venue_address<br/>";
                $events .="$event->venue_city, $event->venue_state_name";
                $events .="<p><a href=$event->ticket_url>Buy Tickets</a></p></div>";
  }
}
// No results were returned
if(empty($events)){
  $events = "Sorry, no events matching $query in $location";
}
// Display results and unset the global array $_GET
echo $events;
unset($_GET);

0 个答案:

没有答案