We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


payflow pro api - curl problem

sstahnke asked
Medium Priority
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 yahoo.com 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('http://www.yahoo.com/');
$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

Watch Question

Most Valuable Expert 2011
Author of the Year 2014

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: pilot-payflowpro.verisign.com
production: payflowpro.verisign.com

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,
radu@u-zine.com, March 2007

Many thanks to Sieber Todd, tsieber@paypal.com

Best regards, ~Ray


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.
Most Valuable Expert 2011
Author of the Year 2014

Great.  That is progress.  Bring this to the server tech support folks, too.  Good luck with it, ~Ray
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.