HTTP/1.1 302 FoundDate: Thu, 02 Jul 2020 03:27:53 GMTServer: ApacheLocation: http://www.photographex.com/erreur.htmlContent-Type: text/html; charset=iso-8859-1
shell(merge("curl -o /dev/null -sI -r0-0 `[[imageURL]]` && curl -o `[[hfsToPosix(filePath)]]` `[[imageURL]]`"))
shell(merge("curl -o /dev/null -sI -r0-0 `[[imageURL]]` && curl -o `[[hfsToPosix(filePath)]]` `[[imageURL]]`"))
shell(merge("curl -s -o /dev/null -w `%{http_code}` `[[aGoodURL]]`"))
shell(merge("curl -s -o /dev/null -w `%{http_code}` `[[aBogusURL]]`"))
shell(merge("curl -s -o /dev/null -w `%{http_code}` `[[aGoodURL]]`"))
shell(merge("curl -s -o /dev/null -w `%{http_code}` `[[aBogusURL]]`"))
I suppose you are suggesting I should check the HTTP code first and then proceed to the download of the document on the condition of getting 200?
I included that in a previous example for the same reason, but didn't want to risk it messing with the http response code for this test.
One mystery at a time...
$ URL="http://api.twitter.com/1/statuses/public_timeline.json"
$ curl -sI $URL | grep -i Content-Length
Content-Length: 134
shell(merge("curl -sI `[[TheURL]]` | grep -i Content-Length | awk '{print $2}'"))
Or for convenience, the numerical Megabyte size directly:
shell(merge("curl -sI `[[TheURL]]` | grep -i Content-Length | awk '{print $2/1024/1024}'"))
This is my amateurish take, someone more competent may improve it!