tags:

views:

92

answers:

1

I have a php Twitter app which lets you mark tweets as favorite.

I'm doing something like this:

$fav = $twitter->createFavorite("xml", $get_id);//handles api call (using curl)
$fav_result = new SimpleXMLElement($fav);

On my localhost and on one online server all goes well: the tweet is marked as favorite, and the api call returns xml. On another online server, the tweet is also marked as favorite, but php gives an error: Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML'

On the second server, I seem to get an empty string as return value. When I look at the http status codes, when all is well I get a 200, but when things go wrong I get a status code of 0.

When I check the curl_error it says "Failed to open/read local data from file/application"

I think it has to do something with my server configuration. Does anyone have an idea what might be causing this?

+1  A: 

I found the solution here: http://www.milk-hub.net/blog/2008/08/26/curl%5Ferror%5F26 Since no separate postvars are sent, you have to explicitly set the to an empty string:

curl_setopt($curl_handle, CURLOPT_POSTFIELDS, '');
jaronbarends
then close your question or accept it
streetparade