I am using PHP scripts for uploading files on image hosting. The required files are not stored on disk and available through the http url. Therefore, my first step is to download the image to disk:
file_put_contents ('sample.jpg', file_get_contents ($ url)); and then attach it to curl request:
curl_setopt ($ ch, CURLOPT_POSTFIELDS, array ('image' = & gt; '@' Real path 'Sample.jpg'), 'title' = & gt; 'sample.jpg')); Am I able to do this without downloading the file: Specify the URL in the curl parameter to get the data from the URL?
No comments:
Post a Comment