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.'¤cyCode='.$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.
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)
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.