You are here: secure post with PHP and curl (to Paypal IPN) « PHP Programming Language « IT news, forums, messages
secure post with PHP and curl (to Paypal IPN)

Posted by rgparkins on 09/20/05 18:40

HI

I have 2 problems, 1 of which is tied to PHP and 1 loosely tied, so
I'll put this out there.

Got a problem that I have been working on for a while now which
involves implementing the Paypal IPN. I am using PHP 4 to automatically
post back to Paypal and I am using curl package.

I am doing a Custom request and would like to know if anyone has
successfully posted data back to paypal with curl and got something
other than INVALID back. I am always getting INVALID!! :(

I am doign EVRYTHING they tell me to.. ie ordering the parameters and
adding the cmd=_notify-validate

I guess I have 2 questions:

1. Am I using curl properly with this paypal interface or is there
something I am not setting.
2. Has anyone a working version with HTTPS/curl/paypal. I am using the
https://www.eliteweaver.co.uk/testing/ipntest.php to test this.

The code is as follows:

// put all POST variables received from Paypal back into a URL $post =
array();

foreach ($this->paypal_post_vars as $field => $value) {
array_push($post,$field."=".rawurlencode(stripslashes($value)));
}

array_push($post,"cmd=_notify-validate");
$uri = implode("&",$post);
$ch=curl_init();
$this->error_out($uri);

curl_setopt($ch, CURLOPT_URL, $this->url_string);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $uri);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);

$this->paypal_response = curl_exec($ch);
$this->error_response = curl_error($ch);
curl_close($ch);

$this->error_out($this->paypal_response);

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация