Can somebody tell me how to go about copying a file to a server using PHP? Here's an example of what works when calling it through an image tag:
I need to be able to copy it from the external server (note the odd port) to the local one. I've tried using the following script but it keeps coming up with the errors listed below which may be something to do with the port.
$url = "http://www.domain.com:3000/pic.jpg";
$id = ""; //name of the file u want to be placed on your server
$fd = fopen( $url, "rb" )
or die("The remote file does not exist. Please check your URL and try again.");
Warning: fopen(): Circular redirect, aborting. in /usr/home/login/public_html/pic.php on line 11
Warning: fopen(http://domain.com:3000/pic.jpg): failed to open stream: Undefined error: 0 in /usr/home/login/public_html/pic.php on line 11
The remote file does not exist. Please check your URL and try again.
I made some changes to my code which I thought would fix the problem, but I'm still having trouble. When I load this script, it creates the image file and it's the correct size, but it's in ASC-II format and not binary format. Do you have any ideas what the problem is?