<?php
$host = "c3-test.wirecard.com";
$port = 443;
$path = "/secure/ssl-gateway";
$login = "56500";
$pass = "TestXAPTER";
$errno = "401";
$errstr = "auther";
$poststring = "<?xml version='1.0' encoding='UTF-8'?>
<WIRECARD_BXML xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xsi:noNamespaceSchemaLocation='wirecard.xsd'>
<W_REQUEST>
<W_JOB>
<JobID>job 2</JobID>
<BusinessCaseSignature>56500</BusinessCaseSignature>
<FNC_CC_TRANSACTION>
<FunctionID>WireCard Test</FunctionID>
<CC_TRANSACTION mode='demo'>
<TransactionID>2</TransactionID>
<Amount>10</Amount>
<Currency>USD</Currency>
<CountryCode>US</CountryCode>
<RECURRING_TRANSACTION>
<Type>Single</Type>
</RECURRING_TRANSACTION>
<CREDIT_CARD_DATA>
<CreditCardNumber>4200000000000000</CreditCardNumber>
<CVC2>000</CVC2>
<ExpirationYear>2016</ExpirationYear>
<ExpirationMonth>01</ExpirationMonth>
<CardHolderName>Wirecard Test</CardHolderName>
</CREDIT_CARD_DATA>
<CONTACT_DATA>
<IPAddress>67.29.138.2</IPAddress>
</CONTACT_DATA>
<CORPTRUSTCENTER_DATA>
<ADDRESS>
<Address1></Address1>
<City></City>
<ZipCode></ZipCode>
<State></State>
<Country></Country>
<Phone></Phone>
<Email>support@wirecard.com</Email>
</ADDRESS>
</CORPTRUSTCENTER_DATA>
</CC_TRANSACTION>
</FNC_CC_TRANSACTION>
</W_JOB>
</W_REQUEST>
</WIRECARD_BXML>";
$fp = fsockopen("ssl://".$host, $port, $errno, $errstr, 5);
if(!$fp){
//error; tell us
echo "Error: $errstr ($errno)\n";
}else{
//send the server request
fputs($fp, "POST $path HTTP/1.0\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp,"Content-type: text/xml\r\n");
fputs($fp, "Content-length: ".strlen($poststring)."\r\n");
fputs($fp, "Authorization:
Basic ".base64_encode($login.":".$pass."\r\n"));
fputs($fp, "Connection: close\r\n");
fputs($fp,"\r\n");
fputs($fp, $poststring . "\r\n\r\n");
// prepare for reading the response
stream_set_timeout($fp,30);
// here we save the response body - XML response from WireCard
$output = "";
// here we store the HTTP headers
$headers= "";
// temp. variable for detecting the end of HTTP headers.
$is_header = 1;
while(!feof($fp)) {
$buffer = fgets($fp, 128);
// fgets on SSL socket
if ($buffer == FALSE) {
break;
}
if (!$is_header) {
$output .= $buffer;
}
if ($buffer == "\r\n") {
$is_header = 0;
}
if ($is_header) {
$headers .= $buffer;
}
}
//close fp - we are done with it
fclose($fp);
// print the results in Web Browser - and convert all special
// characters (like <,>,...) to HTML entities
echo "<PRE>\n";
echo htmlentities($headers);
echo "\n";
echo htmlentities($output);
echo "</PRE>\n";
}
?>
preferences:
75.1 ms | 411 KiB | 5 Q