n1concepts Posted July 27, 2015 Share Posted July 27, 2015 Hi, 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) brgds, Craig Quote Link to comment https://forums.phpfreaks.com/topic/297495-need-to-echo-curl-url-string-showing-appended-data-to-link/ Share on other sites More sharing options...
requinix Posted July 27, 2015 Share Posted July 27, 2015 (edited) Set CURLINFO_HEADER_OUT=true with your other options, then use curl_getinfo($request, CURLINFO_HEADER_OUT)to get the request headers. Edited July 27, 2015 by requinix 1 Quote Link to comment https://forums.phpfreaks.com/topic/297495-need-to-echo-curl-url-string-showing-appended-data-to-link/#findComment-1517499 Share on other sites More sharing options...
n1concepts Posted July 28, 2015 Author Share Posted July 28, 2015 Thanks - I will implement tomorrow morning and update ticket with result (appreciate your help!) Quote Link to comment https://forums.phpfreaks.com/topic/297495-need-to-echo-curl-url-string-showing-appended-data-to-link/#findComment-1517507 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.