Scrape here <br>

<br>
 <br>
 <form method="post">
 <input type="text" name="url" placeholder="URL"/>

<input type="text" name="tag" placeholder="Tag Name"/>
 <input type="text" name="an" placeholder="Attribute Name"/>

<input type="text" name="av" placeholder="Attribute Value"/>

<input type="submit" name="submit"/>

</form>

<?php
 if(isset($_POST['submit'])){

$url= $_POST['url'];
 $tag= $_POST['tag'];
 $an= $_POST['an'];
 $av= $_POST['av'];

$html = file_get_contents($url);

if (!empty($html)) {
 $obj_DOM = new DOMDocument();
 libxml_use_internal_errors(TRUE); //use it to disable libxml errors
 $obj_DOM->loadHTML($html);
 }

//-------------------------------------------------------------------

$obj_DOMPath = new DOMXPath($obj_DOM);
 //----------------------------------------------------------------
 $step_1 = '//'.$tag.'[@'.$an.'='."'".$av."']";
 $step_2 = $obj_DOMPath->query($step_1);

//------------------------------------------------------------------
 $step_4 = array();
 foreach ($step_2 as $step_3) {
 $step_4[] = $step_3;
 }
 //echo"<pre>"; print_r($step_4);
 //----------scrape.php-----------------------------------------------------
 $step_5 = array();
 foreach ($step_4 as $item) {
 if (!empty($item->tagName) && $item->tagName == $tag ) {
 $step_5[] = $item->nextSibling;
 }
 }

echo "<pre>"; print_r($step_5);

?>

Leave a Reply