cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Curl works in command-line but not on web...

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Fri, 6 Oct 2006 04:26:09 -0500

On 10/6/06, Rune Fjellheim <rf_at_ghsdk.dk> wrote:
>
> A command-line request as root for the same page gives:
>

Could you su to whatever userid Apache is using and try the command
line again?? It probably isn't running as root, and maybe Apache's
userid isn't allowed to make outgoing connections... I wouldn't know
why, unless it's a security thing. Or maybe Apache itself isn't
allowed to make outgoing connections.

Try changing the url, as well. I just tried this:

   curl_setopt($ch, CURLOPT_URL, "file:///etc/hosts");

and got this response:

   INFOArray
   (
       [url] => file:///etc/hosts
       [http_code] => 0
       [header_size] => 0
       [request_size] => 0
       [filetime] => -1
       [ssl_verify_result] => 0
       [redirect_count] => 0
       [total_time] => 4.8E-05
       [namelookup_time] => 0
       [connect_time] => 0
       [pretransfer_time] => 0
       [size_upload] => 0
       [size_download] => 1928
       [speed_download] => 40166666
       [speed_upload] => 0
       [download_content_length] => 1928
       [upload_content_length] => 0
       [starttransfer_time] => 8.9E-05
       [redirect_time] => 0
   )

   RESULT1

   CURLERR0

   CURLVERSIONArray

along with my whole hosts file. You might also try:

   curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1");

That might as least help to pinpoint where things are breaking down...

Ralph Mitchell
Received on 2006-10-06