payflow pro api - curl problem

Posted on 2009-02-09
Last Modified: 2013-11-29
I'm having a hard time getting this code to work.

All I'm trying to do initially is make the provided example work on my server with my payflow pro login info. I know my login info is valid and works and I know curl is enabled on my server. I did a test to to check curl and it returned headers fine (see code).

I've gone through every part payflow_curl.php and it works fine up to the actual curl request but for some reason the request doesn't seem to be going through. The only thing $headers returns is the url and a filename value of -1. All other values are 0

Any help would be greatly appreciated. Thanks.

// test example that worked.

$ch = curl_init('');


$headers = curl_getinfo($ch);


// code from api that doesn't work

      $ch = curl_init(); 

      curl_setopt($ch, CURLOPT_URL, $this->submiturl);

      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

      curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);

      curl_setopt($ch, CURLOPT_HEADER, 1); // tells curl to include headers in response

      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable

      curl_setopt($ch, CURLOPT_TIMEOUT, 45); // times out after 45 secs

      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);

      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // this line makes it work under https

      curl_setopt($ch, CURLOPT_POSTFIELDS, $plist); //adding POST data

      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2); //verifies ssl certificate

      curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE); //forces closure of connection when done 

      curl_setopt($ch, CURLOPT_POST, 1); //data sent as POST 


      $result = curl_exec($ch);

      $headers = curl_getinfo($ch);


Open in new window

Question by:sstahnke
    LVL 107

    Expert Comment

    by:Ray Paseur
    As with most things, it is helpful to see the ACTUAL code used in the test case.  This appears to be a very abbreviated segment.  Wouldn't there be a class and some conditional logic also?  If you can post that, we might be able to help.  

    The README file indicates that if you don't get a response, you can simply re-submit the transaction.  What happens when you do that?

    Would we be on firm ground in understanding that you have contacted Radu Manole and there was no help there?

    Here is the README file:
    Implementation of PayFlow API with PHP and CURL using the HTTP protocol (no SDK needed)

    The script implements the HTTPS protocol, via the PHP cURL extension.

    Check payflow_examples.php file for different transactions you can use.

    The URLs to use are:
    for testing:

    The nice thing about this protocol is that if you *don't* get a
    $response, you can simply re-submit the transaction *using the same
    REQUEST_ID* until you *do* get a response -- every time PayPal gets
    a transaction with the same REQUEST_ID, it will not process a new
    transactions, but simply return the same results, with a DUPLICATE=1
    parameter appended.

    API rebuild by Radu Manole,, March 2007

    Many thanks to Sieber Todd,

    Best regards, ~Ray

    Author Comment

    I have contacted Radu and he had some helpful ideas about checking permissions etc on the server. I have also been able to do a successful use of the test code from my local testing server (with all ports open) which seems to reinforce the idea that there is a port that is blocked or a conflicting permission issue on my server. I will post more info as I get it.
    LVL 107

    Expert Comment

    by:Ray Paseur
    Great.  That is progress.  Bring this to the server tech support folks, too.  Good luck with it, ~Ray

    Accepted Solution

    OK. After a long wait the problem has been diagnosed and solved. The server started returning the message "Protocol https not supported or disabled in libcurl" My host was able to re-compile apache with curl ssl support and now the script works fine.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    Specific format 21 105
    Simple Mosaic Web Library 8 49
    PHP get months from date search query where user 40 39
    Search function not working 14 29
    Are you using email marketing software? If not, you're missing out on effortless marketing and the reaching of desired conversion rates through email marketing software.
    Every business owner understands the significance of online customer reviews and the impact it can have on sales and revenues. With technology advancing at such a rapid pace, getting online reviews has never been easier, especially when many regions…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now