这个PHP脚本将所有数据减去XML到浏览器(我正在使用Chrome)。如何抑制输出到屏幕?
Twitcapfunction twitcap()
{
// Set your username and password
$user = 'osoleve';
$pass = '********';
$ch = curl_init("https://twitter.com/statuses/friends_timeline.xml");
curl_setopt($ch,CURLOPT_HEADER,0); // We want to see the header
curl_setopt($ch,CURLOPT_TIMEOUT,30); // Set timeout to 30s
curl_setopt($ch,CURLOPT_USERPWD,$user.':'.$pass); // Set uname/pass
curl_setopt($ch,CURLOPT_RETURNTRANSER,1); // Do not send to screen
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,1);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,1);
$xml = new SimpleXMLElement( curl_exec($ch) );
curl_close($ch);
return $xml;
}
$content = twitcap();
echo "Hello, world.
";
?>