For my web development internship, I need to create an API that pulls info from a web service (https://secure.spectrumretailnet.com/Webservices/WebSvcbeta.Exe/RETAILNET) and displays that info in XML on a web page. This web service provides info from a video rental store.
I need help writing a PHP script to pull one UPC number from that web service and display it in XML. Also, I will eventually create an XHTML form that uses POST instead of GET so I can enter a UPC number in it and display XML on a HTTPS web page.
First I'd just like to figure out how to pull one UPC number from the web service and display it in an XML web page using HTTPS.
My "credentials" are listed below (credentials are fake and I have the real ones but XML tags are real):
<RNID>1234</RNID>
<RNCERT>5555AAAA</RNCERT>
Below is the XML (including credentials above) that I want to display on a HTTPS web page (UPC number is real in code below):
<TRANSACTION>
<RNID>1234</RNID>
<RNCERT>5555AAAA</RNCERT>
<TRANSACTIONTYPE>GETUPCINVENTORY</TRANSACTIONTYPE>
<UPC>883929015368</UPC>
<SHOWITEMDETAILS>TRUE</SHOWITEMDETAILS>
</TRANSACTION>
Below is some of PHP code I'm stuck on:
<?php
// Request Yahoo! REST Web Service using
// file_get_contents. PHP4/PHP5
// Author: Rasmus Lerdorf and Jason Levitt
// February 1, 2006
error_reporting(E_ALL);
$request = 'https://secure.spectrumretailnet.com/Webservices/WebSvcbeta.Exe/RETAILNET';
// Make the request
$xml = file_get_contents($request);
// Retrieve HTTP status code
list($version,$status_code,$msg) = explode(' ',$http_response_header[0], 3);
// Output the XML
echo htmlspecialchars($xml, ENT_QUOTES);
?>
Is there anyway I can pull that UPC number (883929015368) and the rest of the XML into a HTTPS web page using the code above?
Any other suggestions?
Thanks!😉