function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
if(stristr($text, '!twitter'))
{
//now it parses username correctly using str_replace
$username = str_replace('!twitter ','',$text);
//when line with twitterurl is uncommented, causes chat to return HTTP 500
$twitterurl = 'http://twitter.com/statuses/user_timeline/'.$username.'.json?count=1';
$twitterjson = file_get_contents(urlencode($twitterurl));
$blargh = str_replace('[','',$twitterjson);
$ftsb = str_replace(']','',$blargh);
$pjson = json_decode($ftsb);
$twitterhandle = $pjson->('screen_name');
$tweet = $pjson->('text');
$tweet = stripslashes_deep($tweet);
// KEYWORDS TRIGGER START
$this->insertChatBotMessage(
//$this->getPrivateMessageID(),
$this->getChannel(),
"Last tweet by [url=https://www.twitter.com/" . $twitterhandle . "/]@" . $twitterhandle . "[/url]: " . $tweet
//"Testing Username: " . $username . ". JSON is " . $twitterjson . "URL is " . $twitterurl
);
}
Hey, I have this code, it's an extension for Ajax Chat by BlueImp, but it's infuriating me. Every time I try to use it, it returns HTTP error 500. Any ideas why?
Pardon the variable names, I was getting frustrated. The line that gives me trouble is the parsing of the URL to retrieve the Twitter data from. It works fine in browser, but it freaks out the server when I try and use it.
Any help is appreciated

New Topic/Question
Reply



MultiQuote




|