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
Difference Between Shell and Environment Variables
Prevent File Descriptors Inheritance During Linux Fork
How to Monitor the Thread Count of a Process on Linux
Is /Usr/Local/Lib Searched for Shared Libraries
Best Way to Script Remote Ssh Commands in Batch (Windows)
How to Create a Dynamic Variable and Assign Value to It
Bash: Set Array Env Variable and De-Referencing It from Any Shell Script Fails
Unit Testing for Shell Scripts
Why Doesn't Linux Use the Hardware Context Switch via the Tss
Extracting Columns from Text File with Different Delimiters in Linux
Does Linux Schedule a Process or a Thread
Anything Like Dos2Unix for Windows
How to Run Crontab Job Every Week on Sunday
How to Perform a For-Each Loop Over All the Files Under a Specified Path
Best Way to Get MAChine Id on Linux
I Need a List of Async-Signal-Safe Functions from Glibc