Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8676675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:15:24+00:00 2026-06-12T20:15:24+00:00

I know that this might be way too much to ask, but I have

  • 0

I know that this might be way too much to ask, but I have been reading about xml parsing and I just do not understand it! I did not realize that my client had PHP 4 until I was done programming (a lesson well learned), but I need this to work in php4:

$post_string= 'type=xml&cid=55505&minorRev=14&apiKey=4sr8d8bsn75tpcuja6ypx5g3&locale='.$userLocale.'&currencyCode='.$userCurr.'&customerIpAddress='.$userIp.'&customerUserAgent='.$userAgent.'&xml=<HotelListRequest><destinationId>7EEF0188-E4DC-4B45-B4A7-57E3DF950E1F</destinationId><supplierCacheTolerance>MED_ENHANCED</supplierCacheTolerance><numberOfResults>200</numberOfResults></HotelListRequest>';
//Relative path to the file with $_POST parsing
$path = "http://api.ean.com/ean-services/rs/hotel/v3/list"; 
$ch = curl_init($path); 
$fp = fopen('xml/data.xml','w');
//Send the data to the file
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/xml')); 
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FILE, $fp);
$val = curl_exec($ch);
curl_close($ch);//Close curl session
fclose($fp); //Close file overwrite
$data = simplexml_load_file('xml/data.xml');

I am simply stumped. I have only ever used this format to read an xml document. Can anyone out there transform this to work on php4?? Again I know that this is a lot to ask, but any help would be so greatly appreciated. Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:15:26+00:00Added an answer on June 12, 2026 at 8:15 pm

    You should make a note to your client that PHP 4 has not had any support at all since August 8th, 2008!

    That said, read this question which already address your problem.

    (from referenced answer)

    $xml = ...; // Get your XML data
    $xml_parser = xml_parser_create();
    
    // _start_element and _end_element are two functions that determine what
    // to do when opening and closing tags are found
    xml_set_element_handler($xml_parser, "_start_element", "_end_element");
    
    // How to handle each char (stripping whitespace if needs be, etc
    xml_set_character_data_handler($xml_parser, "_character_data");  
    
    xml_parse($xml_parser, $xml);
    

    If your client really want to stick with unsupported PHP versions (or can’t migrate to PHP 5), it is something that he should assume the cost for; maintaining legacy code usually requires more efforts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i know this might be too match to ask but need help getting the
I know that this sort of question has been asked here before, but still
I know that this question must have been asked and answered a million times,
I know that this has already been asked here but the answer (using a
This might be a way too generic question, but what is the general approach
The question might be pretty vague I know. But the reason I ask this
I know that this is a newbie question but I am a newbie so
I know that this question had already been asked a couple of times before,
I know that this feature will be deprecated in C++0x, but for me as
this might be a stupid question, but I'm using asp.net list control that creates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.