Jump to content

Need to echo cURL URL string showing appended data to link

Recommended Posts



I'm working on implementing the Payflow api into a php-based website and having issues with the payments processing at PayPal.

Note: the PayPal api is using the Payflow class - that class can be found via this link: https://github.com/rcastera/Paypal-PayFlow-API-Wrapper-Class/blob/master/Class.PayFlow.php


Paypal is now asking for me to produce the actual API call - from the cURL prior to that cURL process firing so I need to - some how - echo out that prepared URL statement from the 'public' function to which I can then save to a file or in a MySQL database table.


I need some guidance to help me get that URL echo'ed or assigned to a local var from the OOP class named 'payFlow and method named, 'processTransaction' - see excerpt of that class below: lines 609 thru 641 from the provided link: https://github.com/rcastera/Paypal-PayFlow-API-Wrapper-Class/blob/master/Class.PayFlow.php

  public function processTransaction() {
    // Uses the CURL library for php to establish a connection,
    // submit the post, and record the response.
    if(function_exists('curl_init') && extension_loaded('curl')) {
      $request = curl_init($this->getEnvironment()); // Initiate curl object
      curl_setopt($request, CURLOPT_HTTPHEADER, $this->getHeaders($this->NVP));
      curl_setopt($request, CURLOPT_HEADER, 1); // Set to 0 to eliminate header info from response
      curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
      curl_setopt($request, CURLOPT_TIMEOUT, 45); // times out after 45 secs      
      curl_setopt($request, CURLOPT_FORBID_REUSE, TRUE); //forces closure of connection when done 
      curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // Uncomment this line if you get no gateway response.
      curl_setopt($request, CURLOPT_POST, 1); //data sent as POST
      curl_setopt($request, CURLOPT_POSTFIELDS, $this->getNVP()); // Use HTTP POST to send the data
      $postResponse = curl_exec($request); // Execute curl post and store results in $post_response
      // Additional options may be required depending upon your server configuration
      // you can find documentation on curl options at http://www.php.net/curl_setopt
      curl_close($request); // close curl object
      // Get the response.
      $this->response = $postResponse;
      $this->response = $this->parseResults($this->response);
      if(isset($this->response['RESULT']) && $this->response['RESULT'] == 0) {
        return TRUE;
      else {
        return FALSE;     
    else {
      return FALSE;

Again, what i need is the ability to (some how) capture $request and echo that out (return that value) outside the function so I can assign to a local variable to then save to MySQL database or echo at a later date.


Any help accomplishing this task - which is prior to line 628 - appreciated (thx)




Share this post

Link to post
Share on other sites

Set CURLINFO_HEADER_OUT=true with your other options, then use

curl_getinfo($request, CURLINFO_HEADER_OUT)
to get the request headers. Edited by requinix
  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.