Visa ett inlägg
Oläst 2011-02-16, 09:55 #1
it-shoppen it-shoppen är inte uppkopplad
Nykomling
 
Reg.datum: Dec 2008
Inlägg: 30
it-shoppen it-shoppen är inte uppkopplad
Nykomling
 
Reg.datum: Dec 2008
Inlägg: 30
Standard cURL hämta url från textfil ?

Hej

Behöver hjälp med detta script.
Scriptet nedan fungerar men det jag vill är att ha alla url i en text fil i stället för att ha de inskrivna i scriptet.

Den textfil jag har är alla url på varsin rad.

http://www.test1.se
http://www.test2.se
http://www.test3.se
http://www.test4.se
http://www.test5.se


--------------------------------------

<?php
set_time_limit(10000);

$urls = Array(
'http://www.test1.se/',
'http://www.test2.se/',
'http://www.test3.se/',
'http://www.test4.se/',
'http://www.test5.se/'
);

foreach ($urls as $url) {

$artid = substr("$url", 36, 6);

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

$file = curl_exec ($ch);

file_put_contents("spec/$artid.htm",$file,LOCK_EX);

curl_close ($ch);

}

echo $file;


?>
it-shoppen är inte uppkopplad   Svara med citatSvara med citat