php - Download all images from a website url -


I need to download all the images from a URL.
I am searching but I never got the right answer for it.
I have a page that will accept the website URL in the input box, and after submitting it will download all the images from that website.
I have received this code from the Web, but I do not know where to put the usage or web URL, for example I

  $ url = $ _REQUEST ['webUrl'] Want to download all images; $ String = FetchPage ($ url); $ Image_regex_src_url = '/ / lt; img [^ & gt;] * '' Src = [\ "| \ '] [\ (*.)" | \ '] / Ui'; $ Image_regex_src_url = '/ / lt; img [^ & gt;] * '' Src = [\ "| \ '] [\ (*.)" | \ '] / Ui'; Preg_match_all ($ image_regex_src_url, $ string, $ out, PREG_PATTERN_ORDER); $ Images_url_array = $ out [1]; Forex Currency ($ images_url_array as $ pica) {echo & lt; Img src = "'. $ Pica." "& gt; '$ filename [] = $ pica;} $ _SESSION [' filesArr '] = $ fileNames; function FetchPage ($ path) {$ file = fopen ($ path," R "); if (! $ File) {exit ("unknown url");} $ data = ''; while (.fif ($ file)) {$ data. = Fgets ($ file, 1024);} $ data return;}   

This is my download script

$ files = array (''); $ zip = new ZIPPrechev ();

  $ tmp_file = tempnam ($. ',' '); $ Zip- & gt; open ($ tmp_file, zip archive ::); Foreign currency (dollar files as $ $) {$ download_file = file_get_contents ($ file); $ Zip- & Gt; addFromString (basename ($ file), $ download_f Ile);} # Close zip $ zip-> Off (); Send the file as a download header to the browser ('content-nature: attachment; file name = download.zip'); header ('content -property: app / zip '); readfile ($ tmp_file);    

You can use wget ... for example:

  wget -r -A = .jpg, .png http://www.microsoft.com /en-ph/default.aspx    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -