I created a web page in PHP that has a form which accesses a video rental web service URL.
When a DVD UPC number is entered into the form and I click submit, XML data from the web service is displayed. Also, this XML is surrounded by XHTML.
How do I stylize the XML tags so that it works in Firefox and IE 6-7? 😕
I've tried CSS to stylize the XML tags and it only works in Firefox. Also, I tried using JavaScript DOM to stylize the XML and that also only worked in Firefox.
I would be fine with using XSLT, JavaScript, or PHP to accomplish this.
My code below is included for:
index40.php - PHP web page with form and the function that calls the XML
data40.php - PHP web page that creates XML string
index40.php source code - Source code of PHP web page with form and XML in the middle of XHTML
Any help would be appreciated!
<?php
//index40.php
session_start();
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">
<head>
<title>RetailNet Database Test Page from Matt</title>
</head>
<body>
<h2>RetailNet Database Test Page from Matt</h2>
<p>
<strong>UPCs to Test:</strong><br />
097363455547 - <em>Mad Hot Ballroom</em><br />
</p>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?go" id="searchForm" name="searchForm">
<input type="text" size="20" maxlength="40" name="upc" value="" /> <a href="<?=$_SERVER['PHP_SELF']?>">Back to Search Page Start</a>
<br />
<br />
<input type="submit" id="submit" name="submit" value="Submit" />
</form>
<br />
<br />
<div id="alterXml">
<?php
$queryString = $_SERVER["QUERY_STRING"];
if ($queryString == 'go') { ?>
<?php
function postHttps($url, $request) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1) ;
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
?>
<?php
include('data40.php');
//URL BELOW IS FAKE
echo postHttps("https://webservice.exe", utf8_encode($xml_output));
?>
<?php } ?>
<div><!-- alterXml ID -->
<br />
<br />
</body>
</html>
<?php
//data40.php
// check that form has been submitted and that name is not empty
if ($_POST && !empty($_POST['upc'])) {
// set session variable
$_SESSION['upc'] = $_POST['upc'];
}
$xml_output .= '<TRANSACTION>';
$xml_output .= '<RNID>2341</RNID>';
$xml_output .= '<RNCERT>5E95798A20D9745B67FAFC3661A3EE5C0C5BDF95</RNCERT>';
$xml_output .= '<TRANSACTIONTYPE>GETUPCINVENTORY</TRANSACTIONTYPE>';
$xml_output .= '<UPC>'.$_SESSION['upc'].'</UPC>';
$xml_output .= '<SHOWITEMDETAILS>TRUE</SHOWITEMDETAILS>';
$xml_output .= '</TRANSACTION>';
if (isset($_COOKIE[session_name()]))
{
setcookie(session_name(), '', time()-86400, '/');
}
ob_end_flush();
// end session
session_destroy();
?>
<?
//index40.php source code
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US">
<head>
<title>RetailNet Database Test Page from Matt</title>
</head>
<body>
<h2>RetailNet Database Test Page from Matt</h2>
<p>
<strong>UPCs to Test:</strong><br />
097363455547 - <em>Mad Hot Ballroom</em><br />
</p>
<form method="post" action="/rndb/rndbTEST/xmlEX/index40.php?go" id="searchForm" name="searchForm">
<input type="text" size="20" maxlength="40" name="upc" value="" /> <a href="/rndb/rndbTEST/xmlEX/index40.php">Back to Search Page Start</a>
<br />
<br />
<input type="submit" id="submit" name="submit" value="Submit" />
</form>
<br />
<br />
<div id="alterXml">
<TRANRESP>
<USEDINVENTORY>
<RNID>2341</RNID>
<UPC>097363455547</UPC>
<ITEMDETAIL>
<ITEMIDENT>67627</ITEMIDENT>
<STARTDATE>10/14/2005</STARTDATE>
<BINLOCATION>DOCUMENT</BINLOCATION>
<ITEMCOST>18.46</ITEMCOST>
<LOCATION>IN HOUSE</LOCATION>
</ITEMDETAIL>
</USEDINVENTORY>
<UPCINVENTORY>
<RNID>2341</RNID>
<UPC>097363455547</UPC>
<QTYRENT>1</QTYRENT>
<RENTALRATES>
</RENTALRATES>
<QTYUSEDSALE>0</QTYUSEDSALE>
<QTYDELETED>0</QTYDELETED>
<QTYSOLD>0</QTYSOLD>
<QTYRENTED>0</QTYRENTED>
<QTYNEWSALE>0</QTYNEWSALE>
</UPCINVENTORY>
<TRANSUCCESS>TRUE</TRANSUCCESS>
<TRANRESPMESSAGE></TRANRESPMESSAGE>
<SERVERDATE>11/06/2008</SERVERDATE>
<SERVERTIME>19:15:38</SERVERTIME>
</TRANRESP>
<div><!-- alterXml ID -->
<br />
<br />
</body>
</html>