maccy93 Posted January 12, 2012 Share Posted January 12, 2012 I need to get images from a site remotely. I own and control the site I am getting trying to get the files from. I tried the following: //write the new file to disk $fh = fopen($fileLocationHost, 'w') or //get the contents of the file from the 2spring server according to the coordinates $newImage = file_get_contents('http://www.mysite.co.uk/'.$imageLocation.'/'.$imageName); //write the changes fwrite($fh, $newImage); //close the files fclose($fh); It worked... kind of. It downloaded something but the png image was unreadable. I then found this link: http://www.edmondscommerce.co.uk/php/php-save-images-using-curl/ which talks about a problem with allow_url_fopen and uses CURL to grab images from another site... however I cannot use CURL as it is disabled. Is there a way of writing an image to a server another way? Is there a way of doing this via fopen? Any help would be very much appreciated (I also cannot use fsockopen either as this is also disabled) Quote Link to comment https://forums.phpfreaks.com/topic/254901-grab-png-image-remotely-without-curl/ Share on other sites More sharing options...
Psycho Posted January 12, 2012 Share Posted January 12, 2012 I need to get images from a site remotely. I own and control the site I am getting trying to get the files from. If you own/control the site then get the images via the FTP functions built into PHP. Quote Link to comment https://forums.phpfreaks.com/topic/254901-grab-png-image-remotely-without-curl/#findComment-1306987 Share on other sites More sharing options...
requinix Posted January 12, 2012 Share Posted January 12, 2012 copy works too. Quote Link to comment https://forums.phpfreaks.com/topic/254901-grab-png-image-remotely-without-curl/#findComment-1307060 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.