2010-06-14 69 views
3

我使用这个PHP类Twitter的脚本:我的Twitter脚本停止工作!

twitter.slawcup.com/twitter.class.phps

的脚本是:

$t= new twitter(); 
$t->username='someuser'; 
$t->password='somepass'; 
$res = $t->update($tweet); 
if($res===false){ 
    echo "ERROR<hr/>"; 
    echo "<pre>"; 
    print_r($t->responseInfo); 
    echo "</pre>"; 
}else{ 
    echo "SUCCESS<hr/>Status Posted"; 
} 

其中变量$鸣叫是之前生成的字符串。

它一直工作到6月8日,然后它就死了。

现在,当我运行的代码,它给了我:

ERROR 
Array 
(
    [url] => http://twitter.com/statuses/update.xml 
    [content_type] => application/xml; charset=utf-8 
    [http_code] => 400 
    [header_size] => 1096 
    [request_size] => 120 
    [filetime] => -1 
    [ssl_verify_result] => 0 
    [redirect_count] => 0 
    [total_time] => 0.11795 
    [namelookup_time] => 3.3E-5 
    [connect_time] => 0.014397 
    [pretransfer_time] => 0.014405 
    [size_upload] => 0 
    [size_download] => 148 
    [speed_download] => 1254 
    [speed_upload] => 0 
    [download_content_length] => 148 
    [upload_content_length] => 0 
    [starttransfer_time] => 0.117829 
    [redirect_time] => 0 
) 

出了什么问题?它特别奇怪,因为它工作正常,然后停止。

回答

0

已解决。这是我的主机提供商的错。 PHP没有正确设置。

1

它返回错误代码400,如果你看看http://en.wikipedia.org/wiki/List_of_HTTP_status_codes错误代码说

Bad Request 
The request contains bad syntax or cannot be fulfilled. 

这将涉及到一些错误的类...但它是很难看到没有校验码。

##请确保您有类的最新版本。##

+0

除此之外 - 如果你的代码没有变化,那么twitter现在也可能有困难。我会验证正确的语法是通过他们的API文档发送给Twitter的。 – 2010-06-14 16:06:58

1

什么身份验证模式是您使用? Twitter将弃用对auth-basic的支持,即使它仍然有效,我会考虑尽快迁移到Oauth。