How can I use PHP to download files from the network to the server where the PHP file is located? For example, if php file A is on server A, server B has an image a with the address www.xxx.xximagesxx.jpg. Which function can be used to download image A to server A after php file A is executed? By the way, find a complete Chinese PHP function manual. ------ Solution ------------------ how does PHPc use PHP to download files from the network to the server where the PHP file is located?
For example, if php file A is on server A and server B has an image A, its address is http://www.xxx.xx/images/xx.jpg.
Which function can be used to download image A to server A after php file A is executed?
By the way, find a complete Chinese PHP function manual.
------ Solution --------------------
PHP code
$ Content = file_get_contents ("http://www.xxx.xx/images/xx.jpg"); file_put_contents ("img.jpg", $ content );