Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml_parse hanging local server

Status
Not open for further replies.

BFreshour

Programmer
Mar 20, 2002
84
I have a local PHP server running on Apache 2.0.50 on Windows 2000.

I'm running PHP version 4.3.9.

I'm attempting to parse some data using an XML parser class, but it is hanging while parsing the data. The data is pulled from a URL and then sent to the parser.

The parse works fine on my web host, but I wanted to set it up locally just to test some things and I'm unable to do so.

Here's the code for the parse function in the class, notice my die class, it never gets ran. The server hangs forever. If I put it above the xml_parse line, it gets ran and performs the die().

Code:
     function Set_xml_data( &$xml_data )
     {
       $this->index = 0;
       $this->pointer[] = &$this->obj_data;
  	   
       $this->xml_data = $xml_data;
       $this->xml_parser = xml_parser_create( "UTF-8" );
  		
       xml_parser_set_option( $this->xml_parser, XML_OPTION_CASE_FOLDING, false );
       xml_set_object( $this->xml_parser, &$this );
       xml_set_element_handler( $this->xml_parser, "_startElement", "_endElement");
       xml_set_character_data_handler( $this->xml_parser, "_cData" );
  		
       xml_parse( $this->xml_parser, $this->xml_data, true )  or 
                die(sprintf("XML error: %s at line %d", 
                            xml_error_string(xml_get_error_code($this->xml_parser)), 
                            xml_get_current_line_number($this->xml_parser)));
       die('hang test!');
       xml_parser_free( $this->xml_parser );
       
     }

Here's how I'm passing the data to it, like I said it works fine on my actual host...

Code:
	$url = "[URL unfurl="true"]http://www.somehost.com/xml.xml";[/URL]
	$handle = fopen($url, "r");
	
	$xml_data = '';
	while (!feof($handle)) {
		$xml_data .= fread($handle, 8192);
	}
	fclose($handle);

	$xmlC = new XmlC();
	$xmlC->Set_XML_data( $xml_data );

Any ideas? I was thinking it may be some configuration in my php.ini but I can't find anything that stands out to me.

Please help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top