I'm going to guess that you don't have shell access on that machine.
Make sure your web host can contact api.twitter.com. One way to do
that is with this command curl -v 
http://api.twitter.com/1/statuses/public_timeline.rss

If there's an error or no output then your host has to figure out why
they can't connect to api.twitter.com from that machine.

On Mar 25, 11:54 pm, Dushyant <[email protected]> wrote:
> I did what you said now I get the following output
> Curl error: couldn't connect to host
> Error: 0
>
> On Mar 25, 7:39 pm, natefanaro <[email protected]> wrote:
>
> > At first glance there are two things you want to change. The $url
> > should be changed tohttp://api.twitter.com/1/statuses/update.format
>
> > Not sure why you're trying to run that through a proxy on port 80 but
> > that should be why you're receiving the 404. Remove this line
> > curl_setopt($ch, CURLOPT_PROXY,"localhost:80");
>
> > On Mar 25, 7:37 am, Dushyant <[email protected]> wrote:
>
> > > I have installed WAMP and running PHP scripts on localhost. I have
> > > enabled cURL. Here is my code.
>
> > > <?php
> > > function updateTwitter($status)
> > > {
> > >  // Twitter login information
> > >  $username = 'xxxxx';
> > >  $password = 'xxxxx';
> > >  // The url of the update function
> > >  $url = 'http://twitter.com/statuses/update.xml';
> > >  // Arguments we are posting to Twitter
> > >  $postargs = 'status='.urlencode($status);
> > >  // Will store the response we get from Twitter
> > >  $responseInfo=array();
> > >  // Initialize CURL
> > >  $ch = curl_init($url);
> > >  // Tell CURL we are doing a POST
> > >  curl_setopt($ch, CURLOPT_PROXY,"localhost:80");
> > >  curl_setopt ($ch, CURLOPT_POST, true);
> > >  // Give CURL the arguments in the POST
> > >  curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs);
> > >  // Set the username and password in the CURL call
> > >  curl_setopt($ch, CURLOPT_USERPWD, $username.':'.$password);
> > >  // Set some cur flags (not too important)
> > >  curl_setopt($ch, CURLOPT_VERBOSE, 1);
> > >  curl_setopt($ch, CURLOPT_NOBODY, 0);
> > >  curl_setopt($ch, CURLOPT_HEADER, 0);
> > >  curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
> > >  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> > >  // execute the CURL call
> > >  $response = curl_exec($ch);
> > >  if($response === false)
> > > {
> > >     echo 'Curl error: ' . curl_error($ch);}
>
> > > else
> > > {
> > >     echo 'Operation completed without any errors<br/>';
>
> > > }
>
> > >  // Get information about the response
> > >  $responseInfo=curl_getinfo($ch);
> > >  // Close the CURL connection curl_close($ch);
> > >  // Make sure we received a response from Twitter
> > >  if(intval($responseInfo['http_code'])==200){
> > >   // Display the response from Twitter
> > >   echo $response;
> > >  }else{
> > >   // Something went wrong
> > >   echo "Error: " . $responseInfo['http_code'];
> > >  }
> > > curl_close($ch);
> > >  }
>
> > > updateTwitter("Test tweet");
>
> > > ?>
>
> > > Here's my output
>
> > > Operation completed without any errors
> > > Error: 404
>
> > > Please help.

To unsubscribe from this group, send email to 
twitter-development-talk+unsubscribegooglegroups.com or reply to this email 
with the words "REMOVE ME" as the subject.

Reply via email to