1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
$server = "http://toto/";
$user = "Archivio1";
$pass = "***";
$file = "file.txt";
$url1 = $server."yaya=ID=748925";
echo "$url1\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$user:$pass");
$info = curl_getinfo($ch);
$page1 = curl_exec($ch);
$url2 = substr($page1, strpos($page1, 'BvLTech1_______'));
$url2 = $server.substr($url2, 0, strpos($url2, '"'));
echo "$url2\n";
curl_setopt($ch, CURLOPT_URL, $url2);
$page2 = curl_exec($ch);
$url3 = substr($page2, strpos($page2, 'RNVL/BvLArchivio'));
$url3 = $server.substr($url3, 0, strpos($url3, '"'));
echo "$url3\n";
curl_setopt($ch, CURLOPT_URL, $url3);
$fh = fopen($file, 'w');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_FILE, $fh);
curl_exec($ch);
fclose ($fh);
curl_close($ch); |
Partager