Link to home
Start Free TrialLog in
Avatar of tansofun
tansofun

asked on

Why does xml_parse_into_struct fail on this page?

I'm using php 5.0.3, I cannot upgrade.

<?php
  $url='http://www.inman.com/rss/IMRSS2_Residential.xml';
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  $content = curl_exec ($ch); # This returns HTML
  curl_close ($ch);
 
  $p = xml_parser_create();
  $vals=array();
  $index=array();
  //xml_parse_into_struct($p, $c, $vals, $index);
  $x = xml_parse_into_struct($p, $content, $vals, $index);
  xml_parser_free($p);
?>
Avatar of hernst42
hernst42
Flag of Germany image

Which error do you get, does it work if you create the parser with:
$p = xml_parser_create('UTF-8');
Avatar of tansofun
tansofun

ASKER

that only returns 1 or o.
i get a 0
if the function returns 1 parsing into struct was succesfull (and all data is stored in $vals) what happens if you add at the beginning and you get as result 0:
error_reporting(E_ALL);
ini_set('display_errors', true);
Neither comment helped, an upgrade of php fixed it.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial