• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1421
  • Last Modified:

payflow pro api - curl problem

I'm having a hard time getting this code to work.

http://code.google.com/p/paypal-payflowpro-php/

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/');
curl_exec($ch);
$headers = curl_getinfo($ch);
curl_close($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);
      curl_close($ch);

Open in new window

0
sstahnke
Asked:
sstahnke
  • 2
  • 2
1 Solution
 
Ray PaseurCommented:
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
0
 
sstahnkeAuthor Commented:
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.
0
 
Ray PaseurCommented:
Great.  That is progress.  Bring this to the server tech support folks, too.  Good luck with it, ~Ray
0
 
sstahnkeAuthor Commented:
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.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now