Ciao Filippo, grazie della risposta ma temo di essermi espresso male. Non posso fare un header perchè questo implicherebbe un messaggio di conferma e io voglio un salvataggio automatico. Ti faccio vedere il codice
Codice PHP:
<?
$dom = new domdocument;
$baseurl = 'http://www.asd.asd';
$url ="http://www.asd.asd" ;
@$dom->loadHTMLFile($url);
//Estrarre il titolo
//echo $dom->getElementsByTagName("title")->item(0)->textContent;;
/*
$anchor = $dom->getElementsByTagName('img');
foreach ($anchor as $node) {
echo "c";
$anchor_href=$node->getAttribute('src');
$anchor_text=$node->textContent;
print $anchor_href;
}
*/
$xpath = new domxpath($dom);
$xNodes = $xpath->query('//img[@src]');
foreach ($xNodes as $xNode)
{
$imgsrc = $xNode->getAttribute('src');
$arrIgnore = array(
'immagine1.gif',
'immagine2.gif'
);
$doIgnore = $imgsrc == '';
foreach ($arrIgnore as $sIgnore)
{
if ( !(strpos($imgsrc, $sIgnore) === false) )
{
$doIgnore = true;
break;
}
}
if (!$doIgnore)
{
$href = $xNode->parentNode->getAttribute('href');
/*
echo '<a href="' .
htmlentities($href) . '">';
echo '<img src="' .
htmlentities ($imgsrc) .
'" alt="[Link]" />';
echo '</a> ';
*/
echo $href ."; ";
//imagejpeg($href, "http://localhost/download/", 90);
}
}
?>
Così facendo ottengo i miei url e al posto di imagejpeg (avevo trovato questa diciturama non funziona) vorrei mettere un comando che, prendendo la variabile $href e l'indirizzo di destinazione, faccia il download in automatico.
grazie di tutto