Solved

Why does xml_parse_into_struct fail on this page?

Posted on 2006-11-30
6
689 Views
Last Modified: 2008-01-09
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);
?>
0
Comment
Question by:tansofun
  • 2
  • 2
6 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 18052403
Which error do you get, does it work if you create the parser with:
$p = xml_parser_create('UTF-8');
0
 
LVL 2

Author Comment

by:tansofun
ID: 18052407
that only returns 1 or o.
i get a 0
0
 
LVL 48

Expert Comment

by:hernst42
ID: 18052519
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);
0
 
LVL 2

Author Comment

by:tansofun
ID: 18116065
Neither comment helped, an upgrade of php fixed it.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18473064
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question