Единственная причина, по которой я могу обнаружить, что вы получаете сообщение об ошибке, заключается в том, что вы не заключаете код в теги php. Вставьте следующий код в кодовую панель, и вы получите другую ошибку (я не внес никаких других изменений в ваш код):
<?php
class TwitterGrub{
function twitterCapture($user = 'myUsername',$password = 'myPass') {
$ch = curl_init("https://twitter.com/statuses/user_timeline.xml");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_TIMEOUT, 30);
curl_setopt($ch,CURLOPT_USERPWD,$user . ":" . $password);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
$result=curl_exec ($ch);
$data = strstr($result, '<?');
$xml = new SimpleXMLElement($data);
return $xml;
}
function twitterDisplay($twitNum){
$xml = this->twitterCapture();
for($i= 0; $i<$twitNum; $i++){
//echo "<div class='curvebox'>".$xml->status[$i]->text."</div>";
}
}
}
?>
Затем внесите изменения из этого
$xml = this->twitterCapture();
до
$xml = $this->twitterCapture();
и ошибки волшебным образом исчезнут.