2012-07-25 2 views
0
다음

은 내가 사용하고 내 코드입니다 :페이팔 IPN, PHP

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $this->paypal_url); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $req); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: ' . $url_parsed['host'])); 
$res = curl_exec($ch); 
curl_close($ch); 

this-> paypal_url 샌드 박스 API를 URL과 url_parsed [ '호스트']이 모두 샌드 박스 페이팔 호스트 이름입니다 맞지만, 내가 가지고있는 문제는 $ res가 항상 비어있는 모든 호출에있다.

$fp = fsockopen('ssl://' . $url_parsed['host'],"443",$err_num,$err_str,30); 
fputs($fp, "POST $url_parsed[path] HTTP/1.1\r\n"); 
fputs($fp, "Host: $url_parsed[host]\r\n"); 
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); 
fputs($fp, "Content-length: ".strlen($post_string)."\r\n"); 
fputs($fp, "Connection: close\r\n\r\n"); 
fputs($fp, $post_string . "\r\n\r\n"); 

및 발생 소켓 오류를 열지 못했습니다 :

페이팔 개발자 사이트에서이 코드를 얻기 전에 나는 다음 코드를 사용하고 있었다.

나는이 코드를 사용했다 : $ fp = fsockopen ($ url_parsed [ 'host'], "80", $ err_num, $ err_str, 30);

나는이 응답을 얻고 있었다 :

Server: 
HTTP/1.0 302 Moved Temporarily 
Location: https://www.sandbox.paypal.com 
Server: BigIP 
Content-Length: 0 
X-Cache: MISS from proxyco.confiz.com 
X-Cache-Lookup: MISS from proxyco.confiz.com:3128 
Via: 1.0 proxyco.confiz.com:3128 (squid/2.6.STABLE21) 
Connection: close 

이에 대한 해결책을 찾는 데 도와주세요.

답변

0

희망 다음 링크는

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro 

샘플 코드를 다운로드하려면 .. 당신을 도울 것입니다

https://www.x.com/developers/PayPal/documentation-tools/code-sample/216623 

IPN 리스너 비는 매우 유용하고

을 쉽게 통합 할 수