Maximum function nesting level of '100' reached, aborting
<p>I want to create a crawler who take the informations of all pages one by one from number 0 to 10 000 000. I don't matter how much time it takes. I just want it works. Here is the error i obtain </p>

<pre>Fatal error: Maximum function nesting level of '100' reached, aborting! in D:\wamp\www\crawler\index.php on line 25</pre>

<p>The line 25 is </p>

<pre><code>$htmlstr = (string)$this-&gt;curlGet($url);
</code></pre>

<p>And there is my complete script. </p>

<p>Thank you for your help !</p>

<pre><code>header('Content-Type: text/html; charset=utf-8'); 
ini_set('max_input_nesting_level','100000');
ini_set('max_execution_time','100000'); 

class crawler{

    private $url;
    private $page;
    private $bothurl;
    private $innerDom = null;
    public $prop;
    public $entry;

    function __construct($entry){
        $this-&gt;entry = $entry;
        $this-&gt;bothurl = array('http://www.remax-quebec.com/fr/inscription/Q/'.$entry.'.rmx','http://www.remax-quebec.com/en/inscription/Q/'.$entry.'.rmx');
        $this-&gt;scan();
    }

    private function scan(){
        $i =0;
        foreach($this-&gt;bothurl as $url){
            $this-&gt;url = $url;
            $this-&gt;lang = ($i==0)?'fr':'en';
            $htmlstr = (string)$this-&gt;curlGet($url);
            $dom = new DOMDocument;
            @$dom-&gt;loadHTML($htmlstr);
            $this-&gt;page = $dom;
            $this-&gt;htmlInfos();
            $this-&gt;getInfos();
            $i++;
        }
    }

    private function htmlInfos(){
        $divs = $this-&gt;page-&gt;getElementsByTagName('div');
        foreach($divs as $div){
            if($div-&gt;hasAttribute('class') &amp;&amp; $div-&gt;getAttribute('class') == 'bloc specs'){
                $innerDom = new DOMDocument(); 
                @$innerDom-&gt;loadHTML($this-&gt;innerHTML($div));
                $this-&gt;innerDom = $innerDom;
            }
        }
        if($this-&gt;innerDom === null) $this-&gt;changeEntry();
    }

    private function getInfos(){
        $sect = 0;

        foreach($this-&gt;innerDom-&gt;getElementsByTagName('div') as $div){
        # obtenir la description
             $this-&gt;getDesc($div-&gt;getAttribute('class'),$div);
        # obtenir les caractéristiques
             $this-&gt;getCaract($div-&gt;getAttribute('class'),$div);
        # obtenir les informations interieur, exterieur et evaluation
             if($div-&gt;getAttribute('class') == 'section deux-colonnes'){
                switch($sect){
                    case 0: $this-&gt;getSpecInfos($div,'interieur'); break;
                    case 1: $this-&gt;getSpecInfos($div,'exterieur'); break;
                    case 2: $this-&gt;getSpecInfos($div,'evaluation'); break;
                    case 3: $this-&gt;getSpecInfos($div,'equipement'); break;
                    case 4: $this-&gt;getSpecInfos($div,'services'); break;
                }
                $sect++;
             }else if($div-&gt;getAttribute('class') == 'section'){
        # obtenir les détails des pièces
                foreach($div-&gt;getElementsByTagName('table') as $table){
                    if($table-&gt;getAttribute('class') == 'details-pieces'){
                        $this-&gt;detailPieces($table);
                    }
                }
             }
        }
    }

    private function getDesc($class,$obj){
        if($class == 'section description'){
            $p = $obj-&gt;getElementsByTagName('p')-&gt;item(0);
            $text = (string)$p-&gt;nodeValue;
            $this-&gt;prop[$this-&gt;lang]['description'] = $text;
        }
    }

    private function getCaract($class,$obj){
        if($class == 'section characteristiques'){
            foreach($obj-&gt;getElementsByTagName('div') as $div){
                if(substr($div-&gt;getAttribute('class'),0,4) == "item"){
                    $text = (string)$div-&gt;nodeValue;
                    $this-&gt;prop[$this-&gt;lang]['caracteritiques'][substr($div-&gt;getAttribute('class'),5)] = $text;
                }
            }
        }
    }

    private function getSpecInfos($obj,$nomInfo){
        foreach($obj-&gt;getElementsByTagName('table') as $table){
            foreach($table-&gt;getElementsByTagName('tr') as $tr){
                $name = $tr-&gt;getElementsByTagName('td')-&gt;item(0);
                $value = $tr-&gt;getElementsByTagName('td')-&gt;item(1);
                $name = substr((string)$name-&gt;nodeValue,0,-2);
                $value = (string)$value-&gt;nodeValue;
                $this-&gt;prop[$this-&gt;lang][$nomInfo][$this-&gt;noAccents($name)] = $value;
            }
        }
    }

    private function detailPieces($obj){
        $tbody = $obj-&gt;getElementsByTagName('tbody')-&gt;item(0);
        foreach($tbody-&gt;getElementsByTagName('tr') as $tr){
            $name = $tr-&gt;getElementsByTagName('td')-&gt;item(0);
            $name = (string)$name-&gt;nodeValue;
            $level = $tr-&gt;getElementsByTagName('td')-&gt;item(1);
            $level = (string)$level-&gt;nodeValue;
            $dimensions = $tr-&gt;getElementsByTagName('td')-&gt;item(2);
            $dimensions = (string)$dimensions-&gt;nodeValue;
            $floor = $tr-&gt;getElementsByTagName('td')-&gt;item(3);
            $floor = (string)$floor-&gt;nodeValue;
            $desc = $tr-&gt;getElementsByTagName('td')-&gt;item(4);
            $desc = (string)$desc-&gt;nodeValue;

            $this-&gt;prop[$this-&gt;lang]['pieces'][$this-&gt;noAccents($name)]['etage'] = $level;
            $this-&gt;prop[$this-&gt;lang]['pieces'][$this-&gt;noAccents($name)]['dimensions'] = $dimensions;
            $this-&gt;prop[$this-&gt;lang]['pieces'][$this-&gt;noAccents($name)]['revetement'] = $floor;
            $this-&gt;prop[$this-&gt;lang]['pieces'][$this-&gt;noAccents($name)]['description'] = $desc;
        }
    }

    private function innerHTML($element){ 
        $innerHTML = ""; 
        $children = $element-&gt;childNodes; 
        foreach ($children as $child) 
        { 
            $tmp_dom = new DOMDocument(); 
            $tmp_dom-&gt;appendChild($tmp_dom-&gt;importNode($child, true)); 
            $innerHTML.=trim($tmp_dom-&gt;saveHTML()); 
        } 
        return $innerHTML; 
    }

    private function noAccents($value){
        $string= strtr($chaine,"ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ","aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn");
    }

    private function changeEntry(){
        $this-&gt;entry++;
        echo $this-&gt;entry;
        $this-&gt;scan();
    }

    private function curlGet($url){
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_ENCODING, "gzip");
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
        $data = curl_exec($curl);
        curl_close($curl);
        return $data;
    }
}

$entry = 8678057;

$crawler = new crawler($entry);

echo '&lt;pre&gt;';
print_r($crawler-&gt;prop);
echo '&lt;/pre&gt;';
</code></pre>
