- file_get_contents: documentation ( source)
- preg_split: documentation ( source)
<?php
$remote_links = "http://es.ninemanga.com/chapter/LALEYENDADEASURAPRLOGONovelaCaptulo1/649751/
http://es.ninemanga.com/chapter/UglyDucklingCaptulo5/649745/";
$content_arr = preg_split("/\n/",$remote_links);
$length = count($remote_links);
for($j=0;$j<count($remote_links);$j++){
$html = file_get_contents($remote_links[$j], false, $context);
//Create a new DOM document
$dom = new DOMDocument;
//Parse the HTML. The @ is used to suppress any parsing errors
//that will be thrown if the $html string isn't valid XHTML.
@$dom->loadHTML($html);
//Get all links. You could also use any other tag name here,
//like 'img' or 'table', to extract other tags.
$links = $dom->getElementsByTagName('a');
//Iterate over the extracted links and display their URLs
foreach ($links as $link){
//Extract and show the "href" attribute.
//echo $link->nodeValue;
echo $link->getAttribute('href'), '<br>';
// var_dump ($html);
// $html = str_replace('<br />', ',', $html).PHP_EOL;
//echo $html.PHP_EOL;
//print_r(htmlentities($content).'<br>');
}
// print $content_arr[$i].PHP_EOL;
//print $title.PHP_EOL;
//print $title_no.PHP_EOL;
//print $TITLE_master.PHP_EOL;
}