Curl:Connection Refused

php curl_exec() Connection refused when retrieving a remote image

This is probably not a happy conclusion, at most it's a workaround, but here is what I finally did.

I exported all the images URL from my website database. I created a bash script based on this command:

curl http://img107.xooimage.com/files/5/0/b/ss-2014-06-15-at-12.58.47--46324f5.png > image.png

To save an image from the internet by using a curl.
I ran the script from my personal computer which didn't have the same limitation as my website host.
I could retrieve all the pictures.

If you're not managing the rights/limitations on your host, you probably can't do much more.

Doesn't interrupt curl even if it returns connection refused

You can use the --retry-connrefused flag.

Can someone explain me why curl: (7) Failed to connect to 127.0.0.1 port 2000: Connection refused ?

Purser fields are unexported, so JSON decoder doesn't see them, you need to capitalize them to fix that:

type Puser struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Country string `json:"country"`
CompanyName string `json:"company_name"`
Email string `json:"email"`
Tel string `json:"tel"`
}

Then, also you make wrong request, sending parameters in form data, instead send JSON object in request body, like this:

curl -X POST -d'{"first_name":"pinco", "last_name":"pallo", "company_name":"Company","email":"pinco.pallo@company.com","tel":"111111111"}' 127.0.0.1:2000/puser/add



Related Topics



Leave a reply



Submit