开发者

Sagepay cURL data posting

开发者 https://www.devze.com 2023-01-07 09:21 出处:网络
can any one please let me know where i did the mistake on the below code. I have just post the transaction information to sagepay as the format sugg开发者_如何学编程ested by sagepay. so i have used c

can any one please let me know where i did the mistake on the below code.

I have just post the transaction information to sagepay as the format sugg开发者_如何学编程ested by sagepay. so i have used cURL to post those information. here my doubt is appears on the line number 10. please advise will i use this statement for fresh connection creation?

will it start infinite loop?

<?
1   $curlSession = curl_init();
2   curl_setopt ($curlSession, CURLOPT_URL, $url);
3   curl_setopt ($curlSession, CURLOPT_HEADER, 0);
4   curl_setopt ($curlSession, CURLOPT_POST, 1);
5   curl_setopt ($curlSession, CURLOPT_POSTFIELDS, $data);
6   curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1); 
7   curl_setopt($curlSession, CURLOPT_TIMEOUT,180); 
8   curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, FALSE);
9   curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 1);
10  curl_setopt($curlSession, CURLOPT_FRESH_CONNECT, 1);
11  $rawresponse = curl_exec($curlSession);
?>


Here's what works for me:

<?php

    $curlSession = curl_init();

    curl_setopt($curlSession, CURLOPT_URL, $url);
    curl_setopt($curlSession, CURLOPT_HEADER, 0);
    curl_setopt($curlSession, CURLOPT_POST, 1);
    curl_setopt($curlSession, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curlSession, CURLOPT_TIMEOUT, 30);

    $response = split(chr(10), curl_exec($curlSession));

    curl_close ($curlSession);

?>
0

精彩评论

暂无评论...
验证码 换一张
取 消