steviez Posted January 8, 2008 Share Posted January 8, 2008 Hi, I have just installed a paypal IPN script on my site and im reciveing this error: Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of fsockopen(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. Whats wrong and how can i fix it? Quote Link to comment Share on other sites More sharing options...
toplay Posted January 8, 2008 Share Posted January 8, 2008 Don't use fsockopen( &$var .... use: fsockopen( $var ... or: fsockopen( 'value' ... Quote Link to comment Share on other sites More sharing options...
steviez Posted January 8, 2008 Author Share Posted January 8, 2008 I have done that but now all i get is a blank page and a email saying bad order. Here is the code: <?php class paypal_ipn { var $paypal_post_vars; var $paypal_response; var $timeout; var $error_email; function paypal_ipn($paypal_post_vars) { $this->paypal_post_vars = $paypal_post_vars; $this->timeout = 120; } function send_response() { $fp = @fsockopen( "www.paypal.com", 80, $errno, $errstr, 120 ); if (!$fp) { $this->error_out("PHP fsockopen() error: " . $errstr , ""); } else { foreach($this->paypal_post_vars AS $key => $value) { if (@get_magic_quotes_gpc()) { $value = stripslashes($value); } $values[] = "$key" . "=" . urlencode($value); } $response = @implode("&", $values); $response .= "&cmd=_notify-validate"; fputs( $fp, "POST /cgi-bin/webscr HTTP/1.0\r\n" ); fputs( $fp, "Content-type: application/x-www-form-urlencoded\r\n" ); fputs( $fp, "Content-length: " . strlen($response) . "\r\n\n" ); fputs( $fp, "$response\n\r" ); fputs( $fp, "\r\n" ); $this->send_time = time(); $this->paypal_response = ""; // get response from paypal while (!feof($fp)) { $this->paypal_response .= fgets( $fp, 1024 ); if ($this->send_time < time() - $this->timeout) { $this->error_out("Timed out waiting for a response from PayPal. ($this->timeout seconds)" , ""); } } fclose( $fp ); } } function is_verified() { if( ereg("VERIFIED", $this->paypal_response) ) return true; else return false; } function get_payment_status() { return $this->paypal_post_vars['payment_status']; } function error_out($message, $em_headers) { $date = date("D M j G:i:s T Y", time()); $message .= "\n\nThe following data was received from PayPal:\n\n"; @reset($this->paypal_post_vars); while( @list($key,$value) = @each($this->paypal_post_vars)) { $message .= $key . ':' . " \t$value\n"; } mail($this->error_email, "[$date] paypay_ipn notification", $message, $em_headers); } } ?> Quote Link to comment Share on other sites More sharing options...
toplay Posted January 8, 2008 Share Posted January 8, 2008 I would have been surprised that you got it to work the first time. Now you need to debug your script. Google IPN scripts and tutorials. Also, look at paypals developer support site. Quote Link to comment Share on other sites More sharing options...
steviez Posted January 8, 2008 Author Share Posted January 8, 2008 Thanks for your help, its working now (had to update the DB settings) Quote Link to comment 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.