The patch link address is as follows: http://125.35.6.80:8080/ftba/itownet/download.do?method=downloadFile&fid= 917d9f52486042a4829ea9392b801f6d&ssid=kv_l24clmshsqy7punwrga| |
Using PHP to automatically download to the local, I use file_get_contents and curl two methods are unsuccessful.
The method code I use is as follows:
1) file_get_contents:
$img = file_get_contents (' http://125.35.6.80:8080/ftba/itownet/download.do?method=downloadFile&fid= 917d9f52486042a4829ea9392b801f6d&ssid=kv_l24clmshsqy7punwrga| | ');
File_put_contents (' 1.jpg ', $img);
2) Curl
$ch = Curl_init ();
curl_setopt ($ch, curlopt_post, 0);
curl_setopt ($ch, Curlopt_url, ' http://125.35.6.80:8080/ftba/itownet/download.do?method=downloadFile&fid= 917d9f52486042a4829ea9392b801f6d&ssid=kv_l24clmshsqy7punwrga| | ');
curl_setopt ($ch, Curlopt_returntransfer, 1);
$file _content = curl_exec ($ch);
Curl_close ($ch);
$downloaded _file = fopen (' 1.jpg ', ' W ');
Fwrite ($downloaded _file, $file _content);
Fclose ($downloaded _file);
Hope advice, thank you here.
Reply to discussion (solution)
Curl is missing:
curl_setopt ($ch, curlopt_useragent, $_server[' http_user_agent ');
File_get_contents missing third parameter number:
$context = stream_context_create (Array (' http ' = = Array (' user_agent ' + $_server[' http_user_agent ')));
http://blog.csdn.net/shrimpma/article/details/9816035