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?


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

  • 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 Sep 22 '11 at 12:37
  • @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 Sep 22 '11 at 12:57
  • there's no such file (ls -a and ls -all)... – k102 Sep 22 '11 at 13:06

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.