Solved

Why does xml_parse_into_struct fail on this page?

Posted on 2006-11-30
6
673 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now