How can I get image from url in PHP or Jquery or in both?

前端 未结 5 1602
萌比男神i
萌比男神i 2021-01-29 14:24

Can anybody tell me, how can I get image for a particular site by its url only? As that is done on the google search page. I have searched web but I didn\'t get any satisfactory

5条回答
  •  悲哀的现实
    2021-01-29 15:29

    If you mean that you want to download a JPG/PNG/etc image from a URL then this PHP will do it:

    file_put_contents('image',file_get_contents('http://www.benjiegillam.com/files/img/eye-150.jpg'));
    

    If you mean that you want to take a screenshot of a remote web page then have a look at PhantomJS - see a previous answer of mine here: get webpage print screen, php/unix

提交回复
热议问题