1 Replies - 336 Views - Last Post: 26 September 2012 - 02:10 AM Rate Topic: -----

#1 borninlyoko  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 7
  • View blog
  • Posts: 350
  • Joined: 03-December 09

Chat Script Returns HTTP Error 500

Posted 25 September 2012 - 10:23 PM

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/use​​r_timeline/'.$username.'.json?cou​nt​=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

Is This A Good Question/Topic? 0
  • +

Replies To: Chat Script Returns HTTP Error 500

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1001
  • View blog
  • Posts: 3,555
  • Joined: 05-June 09

Re: Chat Script Returns HTTP Error 500

Posted 26 September 2012 - 02:10 AM

Well, use ini_set('display_errors', 1); and let us know what the error is :)

Really you should only ever be developing with errors displaying so that you can see any issues as they crop up. A 500 server error is not useful to help us debug and we can't help in great amounts because we don't have the related classes to run this code ourselves.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1