views:

50

answers:

1

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 suggested 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);
?>
A: 

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);

?>
Nev Stokes