[PHP] Re: CURL questions
Hello, on 03/29/2007 01:15 PM Angelo Zanetti said the following: 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? It is hard to tell because curl does not output any debugging information. You may want to try this other HTTP client class that can provide debug output, so you can see what exactly going on: http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: CURL questions
Manuel Lemos wrote: Hello, on 03/29/2007 01:15 PM Angelo Zanetti said the following: 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? It is hard to tell because curl does not output any debugging information. Actually it does. http://www.php.net/manual/en/function.curl-setopt.php See CURLOPT_VERBOSE -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: CURL questions
Hello, on 03/30/2007 12:38 AM Chris said the following: 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? It is hard to tell because curl does not output any debugging information. Actually it does. http://www.php.net/manual/en/function.curl-setopt.php See CURLOPT_VERBOSE Interesting. I was not aware of that option. It seems to send some output to stderr. stderr usually goes to Web server error log. But how can we capture that output from a PHP script and display it? -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: CURL questions
Manuel Lemos wrote: Hello, on 03/30/2007 12:38 AM Chris said the following: 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? It is hard to tell because curl does not output any debugging information. Actually it does. http://www.php.net/manual/en/function.curl-setopt.php See CURLOPT_VERBOSE Interesting. I was not aware of that option. It seems to send some output to stderr. stderr usually goes to Web server error log. But how can we capture that output from a PHP script and display it? Set CURLOPT_RETURNTRANSFER and it should return *untested*. Also http://php.net/curl_error can get the error :) -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php