SimpleXML parser error: "Huge input search"

This is my first time using PHP. I am getting the following error when running a 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 can I resolve 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

      

+3


source to share


1 answer


Solution to the problem

To find;

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



Edit;

$xml = simplexml_load_string(curl_exec($ch), 'SimpleXMLElement', LIBXML_COMPACT | LIBXML_PARSEHUGE);

      

+6


source







All Articles