curl can't connect; wget can

1

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?

k102

Posted 2011-09-22T08:35:57.363

Reputation: 147

Answers

2

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

RedGrittyBrick

Posted 2011-09-22T08:35:57.363

Reputation: 70 632

thaks! but i've got a problem: http_proxy is undefined and /usr/local/etc/wgetrc is empty. where can wget store it's settings? – k102 – 2011-09-22T12:37:08.863

@k102: In your home directory (that's what ~/ means) in a file named .wgetrc - remember that ls won't show it without the -a option. – RedGrittyBrick – 2011-09-22T12:57:45.333

there's no such file (ls -a and ls -all)... – k102 – 2011-09-22T13:06:58.830

-1

I've got the same problem, and I just solved it!
The answer is to open the PSAV mode, because the curl use the PORT mode for ftp as default. use it like this:

curl --ftp-port 21  ftp://your.address

Gorden

Posted 2011-09-22T08:35:57.363

Reputation: 1