Fetching data form xml
Posted: Tue Oct 10, 2006 3:39 am
Hi all
I am using "EventInventory Web Services" here is php code for making the call:
All data will be returned in “row” tags with attributes containing the data for each field. Example:
<DATA xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<row THISID="2" THISNAME="Alabama" />
<row THISID="55" THISNAME="Alberta" />
</DATA>
As it shows it will return data in the form on an XML file, i don't know to fetch data and dispay it on my page.
Please help me.
Thanks
I am using "EventInventory Web Services" here is php code for making the call:
Code: Select all
<?
// include the SOAP classes
require_once('nusoap.php');
// define parameter array
$param = array( 'APPCLIENT_ID' => '*CLIENTID*','EVENT_ID' => '','STARTDATE' => '','INCDAYS' => '');
// define path to server application
// Do not hard code the URL here. Get it from a central place like
// configuration file. The below URL is hard coded just for example
// purpose.
$serverpath ='http://services.Preview.EventInventory.com/webservices/TicketSearch.asmx';
//define method namespace
$namespace="http://www.eventinventory.com/webservices/";
// create client object
$soapclient = new soapclient($serverpath);
//set soap Action
$soapAction='http://www.eventinventory.com/webservices/GetVenueList';
//to see debug messages
//$soapclient -> debug_flag = 1;
// make the call
$result = $soapclient->call('GetVenueList',$param,$namespace,$soapAction);
// if a fault occurred, output error info
if (isset($fault)) {
print "Error: ". $fault;
}
else if ($result) {
if ($result[faultstring])
{
print"<h2>Error:</h2>
$result[faultstring]";
}
else //show results
{
$root=$result[ROOT];
$data = $root[DATA];
$row = $data[row];
for($i=0;$i<count($row);$i++)
{
$venueId = $row[$i]['!VID'];
$venueName = $row[$i]['!Name'];
$city = $row[$i]['!City'];
$state = $row[$i]['!State'];
$zip = $row[$i]['!ZipCode'];
print"$venueId : $venueName : $city : state :$zip<br>";
}
}
}
else {
print "No result";
}
// kill object
unset($soapclient);
?><DATA xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<row THISID="2" THISNAME="Alabama" />
<row THISID="55" THISNAME="Alberta" />
</DATA>
As it shows it will return data in the form on an XML file, i don't know to fetch data and dispay it on my page.
Please help me.
Thanks