【发布时间】:2023-03-30 07:30:01
【问题描述】:
我在通过 Twitter 的 API 更新背景时遇到了一点问题。
$target_url = "http://www.google.com/logos/11th_birthday.gif";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$html = curl_exec($ch);
$content = $to->OAuthRequest('http://twitter.com/account/update_profile_background_image.xml', array('profile_background_image_url' => $html), 'POST');
当我尝试通过 cURL 或 file_get_contents 提取原始数据时,我得到了这个...
Expectation Failed Expect 请求头中给出的期望 此服务器无法满足字段。 客户端发送 Expect: 100-continue 但我们只允许 100-continue 的期望。
【问题讨论】:
标签: php xml arrays api twitter