13.01.2013 Views

Connecting to PaymentTrust's Secure Transaction Network - WorldPay

Connecting to PaymentTrust's Secure Transaction Network - WorldPay

Connecting to PaymentTrust's Secure Transaction Network - WorldPay

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

{<br />

// HTTPS<br />

pFile = pConnection->OpenRequest(0, buffer, NULL, 1, NULL, NULL,<br />

INTERNET_FLAG_SECURE |<br />

INTERNET_FLAG_IGNORE_CERT_CN_INVALID);<br />

}<br />

else<br />

{<br />

// HTTP<br />

pFile = pConnection->OpenRequest(0, buffer, NULL, 1, NULL, NULL, 0);<br />

}<br />

}<br />

267<br />

strcpy(buffer, _T(LPCSTR(POSTstring)));<br />

pFile->SendRequest(NULL, 0, buffer, strlen(buffer));<br />

x=pFile->Read(buffer, 9999);<br />

buffer[x]='\0'; // ‘buffer’ contain received data<br />

catch (...)<br />

{<br />

strcpy(buffer, "Exception Error"); // something went wrong<br />

}<br />

// delete/free Internet objects after use<br />

if (pFile) delete pFile;<br />

if (pConnection) delete pConnection;<br />

The WinInet classes fire CInternetException exceptions when something goes wrong. The above<br />

code samples use catch–all exception handlers for simplicity.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!