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

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -