igor berger Posted May 28, 2007 Share Posted May 28, 2007 I use to use file_get_contents to get an image file from another server, but our hosting people have disabled the function. Can I use curl_init() to get the image file from another server? Will this work? $url='http://www.somewebsite.com/image.gif'; vWritePageToFile( $url, $imgtfile ); function vWritePageToFile( $sHTMLpage, $imgfile ) { $sh = curl_init( $sHTMLpage ); $hFile = FOpen( $imgtfile, 'w' ); curl_setopt( $sh, CURLOPT_FILE, $hFile ); curl_setopt( $sh, CURLOPT_HEADER, 0 ); curl_exec ( $sh ); curl_close( $sh ); FClose ( $hFile ); } Link to comment https://forums.phpfreaks.com/topic/53241-can-i-use-curl_init-to-grab-an-image-file-from-another-server/ Share on other sites More sharing options...
igor berger Posted May 29, 2007 Author Share Posted May 29, 2007 I could not find this one on the tree! Maybe the Gremlins hid it, so bumping it up, for another go at it! I hope this is not a taboo question! Link to comment https://forums.phpfreaks.com/topic/53241-can-i-use-curl_init-to-grab-an-image-file-from-another-server/#findComment-263813 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.