help with curl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear All,

I have a script that uses curl to execute an http request now I use the same code for two different servers. And it works on the first server but not the second. I have stored the URL that it generates on the server that doesnt work and if I paste it into the address bar of the browser it works but somehow the script doesnt execute it.


       $ch = curl_init();    // initialize curl handle
       curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
       curl_setopt($ch, CURLOPT_FAILONERROR, 1);
       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
       curl_setopt($ch, CURLOPT_TIMEOUT, 8); // times out after 4s
       curl_setopt($ch, CURLOPT_GET, 1); // set POST method
       curl_setopt($ch, CURLOPT_POSTFIELDS, $dat); // add POST
       curl_setopt($ch, CURLOPT_PORT, $port); // set POST method
       $result = curl_exec($ch); // run the whole process



now is there anything that can be causing this not to execute? I have increasd the timeout to 8 seconds (is this enough). COuld there be a problem with the server not being able to execute a URL in that way?

Is there anything else I can do to trouble shoot this? IF the URL is as follows: http://www.sdfsfjs.com?username=hello&password=goodbye do I need to set the GET variable string seperately in the CURLOPT_POSTFIELDS or can I just send it as one string?

Thanks in advance.

regards



--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 469 1052
*Mobile:*       +27 (0) 72 441 3355
*Fax:*            +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* angelo@xxxxxxxxxxxx <mailto:angelo@xxxxxxxxxxxx>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux