मुझे लगता है कि curl
करने के लिए -f
विकल्प आप क्या चाहते हैं करता है:
-f
, --fail
(HTTP) Fail silently (no output at all) on server errors. This is mostly done to better enable scripts etc to better deal with failed attempts. In normal cases when an HTTP server fails to deliver a document, it returns an HTML document stating so (which often also describes why and more). This flag will prevent curl from outputting that and return error 22. [...]
हालांकि, अगर प्रतिक्रिया वास्तव में था एक 301 या 302 रीडायरेक्ट, कि अभी भी सहेजा जाता है, भले ही अपने गंतव्य एक त्रुटि में परिणाम होगा :
$ curl -fO http://google.com/aoeu
$ cat aoeu
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/aoeu">here</A>.
</BODY></HTML>
अपने मृत अंत करने के लिए पुन: निर्देशन का पालन करने के लिए, यह भी -L
विकल्प देते हैं:
-L
, --location
(HTTP/HTTPS) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place. [...]
। हर किसी ने आपको ऐसी तकनीकें दीं जो कभी भी * कुछ भी डाउनलोड नहीं करतीं, या उन्होंने खुद को रोल करने के लिए कहा। क्या आपको केवल * असली * उत्तर नहीं दिया जाना चाहिए था? – iconoclast