我现在已经遇到这个问题超过4个小时了,所以我来找你,
我正在尝试通过api使用curl代理连接到twitter,
由于某种原因它无法使其发挥作用,
我在这里做错了什么?
<?php
require_once('AuthPlugin/twitteroauth.php');
$twitter = new TwitterOAuth($ConsumerKey, $ConsumerSecret, $AccessToken, $AccessTokenSecret);
$twitter->host = "http://search.twitter.com/";
$search = $twitter->get('search', array('q' => $Keyword, 'rpp' => 1));
//proxy body
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "https://api.twitter.com/1/");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt ($ch, CURLOPT_PROXY,"216.118.70.12:80");
curl_setopt ($ch, CURLOPT_PROXYUSERPWD, 'xxx:xxx');
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
$response = curl_exec ($ch);
$twitter->host = $response;
//$twitter->host = "https://api.twitter.com/1/";
if(is_int($response))
{
die("Errors: " . curl_errno($ch) . " : " . curl_error($ch));
}
curl_close ($ch);
foreach($search->results as $tweet)
{
$status = $trystatus." :) - ".$TheTweet.' RT @'.$tweet->from_user.' '.$tweet->text;
$twitter->post('statuses/update', array('status' => $status));
}
&GT;