Issue while getting data from URL. PHP -


i have following code.

<?php     error_reporting(0);     $url = 'https://www.inmateaid.com/prison-search/all?&page=1';     $output = file_get_contents($url);      $doc = new domdocument();     $doc->loadhtml($output);     $selector = new domxpath($doc);     $anchors = $selector->query("/html/body//div[@class='media']//div/h4//a");     foreach($anchors $a)     {          $output = file_get_contents($a->getattribute("href"));          echo 'hi';     } ?> 

if see below code produces 10 anchors

$anchors = $selector>query("/html/body//div[@class='media']//div/h4//a");

so how should printed 10 times? prints 3 times.

when comment line inside loop, hi printed 10 times.

am missing something?

that due max_execution_time = 30. increased time , issue fixed.


Comments

Popular posts from this blog

mongodb - Struggling to get ordered results from the last retrieved article, given array of elements to search in -

c# - Pausing a storyboard on TabItem mouse over -

c# - Attribute value in root node of xml Linq to XML -