0

I had googled a code to fetch a public twitter content, it work fine when on my localhost but when I put it online on a hosted server, it does not seem to respond at all! Code is as below.

For example url ='https://twitter.com/#!/NatureMagazine'

if($entered['domain']=='twitter.com')
{
    $baseName = basename($url);
    // HINT Code works fine up to here but after this statement, nothing comes out

    $sXML = new SimpleXMLElement('http://twitter.com/users/show.xml?screen_name='.$baseName, NULL, TRUE);

    // TRUE specifies that data is a path or URL to an XML document instead of string data.
    $screen_name                = $sXML->screen_name;
    $location                   = $sXML->location;
    $description                = $sXML->description;
}

Note: The same code works as expected on my local system.

4

1 回答 1

1

注意:在 PHP 5.1.2 之前,需要 --enable-simplexml 来启用这个扩展。

做一个phpinfo()检查 libxml 扩展是否在您的服务器环境中打开。

分享更多关于这正是问题所在。因为从代码中,您没有放置状态检查器来帮助您一路调试。

我希望exit();没有完全上传到服务器。

于 2012-05-07T03:09:17.100 回答