Jump to content

PayPal API Using Curl - How To Prevent Status In Error Log


tomtimms

Recommended Posts

I am currently using the Pay Pal API and whenever I go to the page that connects it shows the complete connection in my error log.  How can I prevent this?  Below is what is printed out.  I tried using "@" before each curl_ reference however this doesn't prevent the error from showing.

 

Connected to api-3t.paypal.com (66.211.168.126) port 443

* successfully set certificate verify locations:

*  CAfile: /etc/pki/tls/certs/ca-bundle.crt

  CApath: none

* SSL connection using DES-CBC3-SHA

* Server certificate:

*        subject: /C=US/ST=California/L=San Jose/O=PayPal, Inc./OU=Information Systems/CN=api-3t.paypal.com

*        start date: 2009-09-24 00:00:00 GMT

*        expire date: 2011-09-19 23:59:59 GMT

*        issuer: /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa ©09/CN=VeriSign Class 3 Secure Server CA - G2

* SSL certificate verify ok.

> POST /nvp HTTP/1.1

Host: api-3t.paypal.com

Accept: */*

Content-Length: 157

Content-Type: application/x-www-form-urlencoded

 

METHOD=GetBalance&VERSION=51.0&PWD=6SZ4PMFR7879HBDB&USER=****_api1.*****.com&SIGNATURE=AFcWxV21C7fd0v3bYYYRCpSSRl31Adju6w2eRqw.IhcgUi1iU1NUsGrQ< HTTP/1.1 200 OK

< Date: Thu, 10 Jun 2010 18:51:58 GMT

< Server: Apache

< Content-Length: 140

< Connection: close

< Content-Type: text/plain; charset=utf-8

* Closing connection #0

* About to connect() to api-3t.paypal.com port 443

*  Trying 66.211.168.126... * connected

* Connected to api-3t.paypal.com (66.211.168.126) port 443

* successfully set certificate verify locations:

*  CAfile: /etc/pki/tls/certs/ca-bundle.crt

  CApath: none

* SSL connection using DES-CBC3-SHA

* Server certificate:

*        subject: /C=US/ST=California/L=San Jose/O=PayPal, Inc./OU=Information Systems/CN=api-3t.paypal.com

*        start date: 2009-09-24 00:00:00 GMT

*        expire date: 2011-09-19 23:59:59 GMT

*        issuer: /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa ©09/CN=VeriSign Class 3 Secure Server CA - G2

* SSL certificate verify ok.

> POST /nvp HTTP/1.1

Host: api-3t.paypal.com

Accept: */*

Content-Length: 157

Content-Type: application/x-www-form-urlencoded

 

here is my connection

 

<?php

 

function PPHttpPost($methodName_, $nvpStr_)

{

 

    $API_UserName =

    $API_Password =

    $API_Signature =

    $API_Endpoint = "https://api-3t.paypal.com/nvp";

 

    $version = urlencode('51.0');

 

    // setting the curl parameters.

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $API_Endpoint);

    curl_setopt($ch, CURLOPT_VERBOSE, 1);

 

    // turning off the server and peer verification(TrustManager Concept).

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

 

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_POST, 1);

 

    // NVPRequest for submitting to server

    $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

 

    // setting the nvpreq as POST FIELD to curl

    curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

 

    // getting response from server

    $httpResponse = curl_exec($ch);

 

 

    if (!$httpResponse) {

        exit("$methodName_ failed: " . curl_error($ch) . '(' . curl_errno($ch) . ')');

    }

 

    // Extract the RefundTransaction response details

    $httpResponseAr = explode("&", $httpResponse);

 

    $httpParsedResponseAr = array();

 

    foreach ($httpResponseAr as $i => $value) {

        $tmpAr = explode("=", $value);

        if (sizeof($tmpAr) > 1) {

            $httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];

        }

    }

 

    if ((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {

        exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");

    }

 

    return $httpParsedResponseAr;

}

?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.