Curl can’t connect; wget can

curlwget

trying to connect to my script on a remote server with curl but:

col-pos-spd# curl -v http://***:80/monitor/reply.php
* About to connect() to *** port 80 (#0)
*   Trying 83.xxx.xxx.2... Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host

then i tried wget and:

wget -v http://***/monitor/reply.php
--2011-09-22 12:29:07--  http://***/monitor/reply.php
Connecting to 83.xxx.xxx.2:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 8 [text/html]
Saving to: `reply.php'

100%[====================================================================================================================>] 8           --.-K/s   in 0s

2011-09-22 12:29:07 (1.05 MB/s) - `reply.php' saved [8/8]

so i can't figure out whi i'm getting an error with curland how can i avoid it?

Best Answer

Proxy request sent, awaiting response... 200 OK

wget may be using a proxy setting whilst curl isn't - check your environment variables (http_proxy?) and startup files.

you can test this with

wget --proxy=off …

wget 1.13 checks environment variables http_proxy, ftp_proxy, no_proxy
curl 7.22 checks environment variables http_proxy, HTTPS_PROXY, FTP_PROXY, GOPHER_PROXY, ALL_PROXY, NO_PROXY

wget can read these settings from ~/.wgetrc
curl can read these settings from ~/.curlrc

Related Question