Re: CURL questions

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

 



On 3/29/07, Angelo Zanetti <angelo@xxxxxxxxxxxx> wrote:
Hi all.

I have a script on a server that does some processing, now I want to
execute that script using cURL. This is a basic scenario and I assume
its possible but its not working.

The script is as follows:

   $url = "http://www..../test.php";;

       $ch = curl_init();
       curl_setopt($ch, CURLOPT_URL, $url);
       curl_setopt($ch, CURLOPT_HEADER, 0);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
       curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a
variable
       curl_setopt($ch, CURLOPT_TIMEOUT, 100);
       $data = curl_exec($ch);
       curl_close($ch);

       echo "DATA: " . $data;

Now the $url I have taken out the path for obvious reasons.

I get a 500 Internal server error, not sure why as this page being
called just inserts a word into a database. Could the cause be something
else network related? What else can I troubleshoot? or is my code incorrect?

TIA

Kind regards

I don't think it makes any difference, but you are defining
CURLOPT_RETURNTRANSFER twice, once with 0 and once with 1. Better
remove one of these :)

Tijnema


--
------------------------------------------------------------------------
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



--
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