-
snaplashAsked on November 19, 2015 at 11:51 AM
I have an automated system and use the csv file to harvest my data from users submissions
When a user submits an image the address in the csv is
http://www.jotform.com/uploads/snaplash/53165496889980/323760246784118644/iStock.jpg
I would like to use this address to curl the image to my system.
However,
the address is really
https://files.jotform.com/jufs/snaplash/53165496889980/323760246784118644/iStock.jpg
stopping my from curl ing the image, can you guys suggest a fix please?
-
SammyReplied on November 19, 2015 at 1:01 PM
I presume you are referring to the PHP CURL operation.
Kindly try using the following PHP code, the function takes two parameters.
The URL of the image and the location the image is to be saved to.
http://pastiebin.com/564e0dc48b991
Also ensure that the allow_url_fopen is enabled in your PHP settings.
Do let us know if this addresses your situation.
-
snaplashReplied on November 19, 2015 at 1:03 PM
actually, I am using a shell script directly
-
SammyReplied on November 19, 2015 at 1:20 PM
I'm not very familiar with using the CURL directive in shell scripts, I did manage to run an example fetching the image link provided over HTTPS using the following command and was able to download the file
curl -o filename.jpg https://files.jotform.com/jufs/snaplash/53165496889980/323760246784118644/iStock.jpg
Here is the screenshot, I ran it in windows. Kindly try and see if it executes correctly on your end.
-
snaplashReplied on November 19, 2015 at 1:27 PM
Yep, that works, but unfortunately that is not the problem. The address of the file in the CSV of the form is:
http://www.jotform.com/uploads/snaplash/53165496889980/323760246784118644/iStock.jpg
and that wont cURL because the file is located in
https://files.jotform.com/jufs/snaplash/53165496889980/323760246784118644/iStock.jpg
How do I get that address passed in my csv?
-
SammyReplied on November 19, 2015 at 1:37 PM
I do see the issue you are referring to now, on the browser the URL will be automatically redirected to the correct one but on CURL the redirection wont work.
Kindly add the -L which is a location header flag, this will allow the URL to resolve correctly for your file, here is an example.
curl -o filenameb.jpg -L http://www.jotform.com/uploads/snaplash/53165496889980/323760246784118644/iStock.jpg
-
snaplashReplied on November 19, 2015 at 1:38 PM
Sammy! Thank you!
That is perfect!
M>
-
SammyReplied on November 19, 2015 at 1:47 PM
Happy to hear the solution works.
If you do encounter any other difficulties feel free to let us know and we will happily assist.