0

i have website and the XML from another site gives booking info within the CDATA and i want to extract the content of this CDATA using PHP and also create a button so when this is clicked this CDAT content is retrieved. Please help

2
Contributors
4
Replies
7
Views
6 Years
Discussion Span
Last Post by alltech
0

Use SimpleXML: http://php.net/manual/en/book.simplexml.php
From that extension you can use simplexml_load_file() with LIBXML_NOCDATA, here's an example:

# XML file
<?xml version='1.0' standalone='yes'?>
<aaa>
	<bbb>
		<id>1</id>
		<title>title 1</title>
		<msg><![CDATA[hello world string]]></msg>
	</bbb>
	<bbb>
		<id>2</id>
		<title>another title</title>
		<msg>another message</msg>
	</bbb>
</aaa>

# PHP file
<?php 
$xml = simplexml_load_file('file.xml', 'SimpleXMLElement',LIBXML_NOCDATA); 
print_r($xml);
?>
0

The problem is there is no xml file. what happens is that on my site someone books a car with parameters such as pick up location, pick up date...etc. When quote button is clicked this send a deep link into another site , ie example... www.website.com ...followed by code and within this is CDATA which we need to extract. Any ideas? you can see the car data we have extracted such as pick up time but we do not have CDATA at present which is required for actually booking the car. see example http://www.whels4rent.net/test00.html

0

hello

The problem is there is no xml file. what happens is that on my site someone books a car with parameters such as pick up location, pick up date...etc. When quote button is clicked this send a deep link into another site , ie example... www.website.com ...followed by code and within this is CDATA which we need to extract. Any ideas? you can see the car data we have extracted such as pick up time but we do not have CDATA at present which is required for actually booking the car. see example http://www.wheels4rent.net/test00.html

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.