post - How can I forward PayPal IPN to another PHP file? -
we updating our system , old ipns need processed differently. however, cannot change original ipn send-to addresses. have "bounce" ipn message off of old_ipnprocessor.php , forward new_ipnprocessor.php. cannot modify old_ipnprocessor.php technical reasons go beyond scope of question.
from have read, have use curl accomplish this. have seen code this, unsure how it's implemented. instance, $post var in code below (from https://stackoverflow.com/a/6213693/1390395) raw json straight paypal. have in php array work?
function forwardipn($post){ $url = "new_ipnprocessor.php"; // $post ipn message paypal $content = $post; $curl = curl_init($url); curl_setopt($curl, curlopt_header, false); curl_setopt($curl, curlopt_returntransfer, true); curl_setopt($curl, curlopt_httpheader, array("content-type: application/json")); curl_setopt($curl, curlopt_post, true); curl_setopt($curl, curlopt_postfields, $content); $json_response = curl_exec($curl); $status = curl_getinfo($curl, curlinfo_http_code); if ( $status != 201 ) { die("error: call url $url failed status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl)); } curl_close($curl); $response = json_decode($json_response, true); }