Advertisement
Advertisement
| 07.28.2008 at 03:11PM PDT, ID: 23602354 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: |
<?php
class PayPalSession
{
var $APIUsername = "";
var $APIPassword = "";
var $APISignature = "";
var $APIVersion = "";
var $EndPointURL = "";
var $SOAPHeader = "";
var $SOAPFooter = "";
function PayPalSession($sandbox)
{
$this -> APIVersion = '53.0';
// Open file outside of web root which contains PayPal credentials. This is for security purposes.
$PayPalCredentials = simplexml_load_file("C:\WebNonPublic\DE-Credentials.xml");
//set the API credentials based on sandbox boolean passed
if($sandbox != true)
{
$this -> APIUsername = $PayPalCredentials -> PayPal -> Production -> Username;
$this -> APIPassword = $PayPalCredentials -> PayPal -> Production -> Password;
$this -> APISignature = $PayPalCredentials -> PayPal -> Production -> Signature;
$this -> EndPointURL = 'https://api-3t.sandbox.paypal.com/2.0/';
}
else
{
$this -> APIUsername = $PayPalCredentials -> Sandbox -> Username;
$this -> APIPassword = $PayPalCredentials -> Sandbox -> Password;
$this -> APISignature = $PayPalCredentials -> Sandbox-> Signature;
$this -> EndPointURL = 'https://api-3t.paypal.com/2.0/';
}
// Create the SOAP header and footer to embed in XML request's later.
$this -> SOAPHeader = '<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" SOAP-ENV:mustUnderstand="1">
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents">
<Username>' . $this -> APIUsername . '</Username>
<Password>' . $this -> APIPassword . '</Password>
<Signature>' . $this -> APISignature . '</Signature>
<Subject/>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body>';
$this -> SOAPFooter = '</SOAP-ENV:Body>
</SOAP-ENV:Envelope>';
} // End function PayPalSession()
|