: This article describes how to use php to download remote image instances through curl. For more information about PHP tutorials, see.
$ Url = 'http: // your function http_get_data ($ url) {$ ch = curl_init (); curl_setopt ($ ch, CURLOPT_CUSTOMREQUEST, 'Get'); curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt ($ ch, CURLOPT_URL, $ url); ob_start (); curl_exec ($ ch); $ return_content = ob_get_contents (); ob_end_clean (); $ return_code = curl_getinfo ( $ Ch, CURLINFO_HTTP_CODE); return $ return_content;} $ return_content = http_get_data ($ url); $ filename = 'test.jpg '; $ fp = @ fopen ($ filename, ""); // bind the file to the stream ?? Fwrite ($ fp, $ return_content); // write a file
The preceding section describes how to use php to download a remote image instance through curl, including related content. if you are interested in the PHP Tutorial.