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

Recommended Answers

All 4 Replies

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);
?>

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.