I use DOMDocument to extract the html page which contains the image file,html page looks like this
<div>
<img src="http://pic.aa.com/a/b/0525">
</div>
After I extracted src address,I put it in this function
copy('http://pic.aa.com/a/b/0525', 'd:tmp/img_name');
Where I don't get is how to decide what extension the file should has,there's no clue from the uri,and the only possible way is by using chrome browser tool to check the response header,but it seems lack of efficiency,anybody knows the proper way to do it?