Jump to content

rdrobertson15@yahoo.com

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rdrobertson15@yahoo.com's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. problem solved. for testing i don’t want certificates so set ” CURLOPT_SSL_VERIFYPEER => FALSE, ” this got me a response. thx again
  2. no I'm not. Using PDT. Don't really need IPN for this app. Just need to get the info from a class registration payment from paypal. the curl_init seems to work. it's the $response = curl_exec($request); and $status = curl_getinfo($request, CURLINFO_HTTP_CODE); that don't appear to be working. Is there a timing issue? I got the code from someone else but it's missing something. thanks
  3. thanks in advance I am using Yahoo webhost with PHP 5.3.6. The application is returning from a Paypal Sandbox transaction. I have the settings on my sandbox correct. I am trying to get the transaction info. i put in some debugging lines so now I get this at the top of the webpage: "CURL_INIT Resource id #3 Response: STATUS: " i perform a $_GET on the calling page and I do get that info displayed. i try to print what is returned from the function below and get nothing Notice the Response and STATUS: have NO info This is code(thanks Torleif Berger who's currently not available) from another page that does the call after Paypal returns to it: <?php include 'process_pdt.function.php'; $payment_data = isset($_GET['tx']) ? process_pdt($_GET['tx']) : FALSE; $current_url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']; ?> ----------------------------------------- The process_pdt code follows <?php <?php include 'token'; /** * Processes a PDT transaction id. * * @author Torleif Berger * @link http://www.geekality.net/?p=1210 * @copyright © 2011 www.geekality.net * @return The payment data if $tx was valid; otherwise FALSE. */ function process_pdt($tx) { // Init cURL $request = curl_init(); printf("CURL_INIT %s\n",$request); // Set request options curl_setopt_array($request, array ( CURLOPT_URL => 'https://www.sandbox.paypal.com/cgi-bin/webscr', CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => http_build_query(array ( 'cmd' => '_notify-synch', 'tx' => $tx, 'at' => $my_token, )), CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HEADER => FALSE, CURLOPT_SSL_VERIFYPEER => TRUE, CURLOPT_CAINFO => 'cacert.pem', )); // Execute request and get response and status code $response = curl_exec($request); printf("Response: %s\n", $response); $status = curl_getinfo($request, CURLINFO_HTTP_CODE); printf("STATUS: \n",$status ); // Close connection curl_close($request); // Validate response if($status == 200 AND strpos($response, 'SUCCESS') === 0) { // Remove SUCCESS part (7 characters long) $response = "SUCCESS"; /* $response = substr($response, 7); // Urldecode it $response = urldecode($response); // Turn it into associative array preg_match_all('/^([^=\r\n]++)=(.*+)/m', $response, $m, PREG_PATTERN_ORDER); $response = array_combine($m[1], $m[2]); // Fix character encoding if needed if(isset($response['charset']) AND strtoupper($response['charset']) !== 'UTF-8') { foreach($response as $key => $value) { $value = mb_convert_encoding($value, 'UTF-8', $response['charset']); } $response['charset_original'] = $response['charset']; $response['charset'] = 'UTF-8'; } // Sort on keys ksort($response); */ // Done! return $response; } $response = "FAIL"; return FALSE; }
×
×
  • 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.