SimpleXML parser error: "Huge input lookup"

10,407

Problem Solved

Find ;

$xml = simplexml_load_string(curl_exec($ch));

Change ;

$xml = simplexml_load_string(curl_exec($ch), 'SimpleXMLElement', LIBXML_COMPACT | LIBXML_PARSEHUGE);
Share:
10,407

Related videos on Youtube

Ümit BÜKÇÜOĞLU
Author by

Ümit BÜKÇÜOĞLU

Updated on June 04, 2022

Comments

  • Ümit BÜKÇÜOĞLU
    Ümit BÜKÇÜOĞLU almost 2 years

    I am using PHP for the first time. I am getting the following error on running the PHP file:

    PHP Warning:  simplexml_load_string(): Entity: line 35909: parser error : internal error: Huge input lookup in /home/alisverispasaji/public_html/system/xml/minikoli/test.php on line 8
    
    PHP Warning:  simplexml_load_string(): p;lt;img src="/UserFiles/FCK/image/prima hangisi(1).jpg" class in /home/alisverispasaji/public_html/system/xml/minikoli/test.php on line 8
    
    PHP Warning:  simplexml_load_string():                                                                                ^ in /home/alisverispasaji/public_html/system/xml/minikoli/test.php on line 8
    
    PHP Fatal error:  Call to a member function children() on boolean in /home/alisverispasaji/public_html/system/xml/minikoli/test.php on line 20
    

    How I can solve this error?

    test.php:

    <?php
    ini_set('user_agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20100101 Firefox/9.0');
    error_reporting(-1);
    
    function simplexml_load_file_curl($url) {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $xml = simplexml_load_string(curl_exec($ch)); // <--- line 8
        return $xml;
    }
    
    $url = 'xml link';
    
    $xml = simplexml_load_file_curl($url);
    
    $veri = '<?xml version="1.0" encoding="UTF-8"?>';
    $veri .= '
    <Urunler>';
    
    foreach($xml->children() as $urun) { // <--- line 20
    

Related