Moin,
das PHP vom Webspace unterstützt leider kein curl, und ich muss daher einen workaround finden. Die Funktion wird von einem Skript gebraucht, das eine Verbindung mit dem PayPal-Server herstellen soll. Hier mal das Skript (ist aus dem PayPal Test SDK):
API_ENDPOINT ist im Moment "https://api-3t.sandbox.paypal.com/nvp"
Hat jemand ne Idee wie ich die curl funktionen ersetzen kann? Habs mal kurz mit fsockopen() probiert, habe aber das dumme Gefühl dasses damit nicht funktioniert...
Gruß, CS
das PHP vom Webspace unterstützt leider kein curl, und ich muss daher einen workaround finden. Die Funktion wird von einem Skript gebraucht, das eine Verbindung mit dem PayPal-Server herstellen soll. Hier mal das Skript (ist aus dem PayPal Test SDK):
PHP:
function hash_call($methodName,$nvpStr)
{
//setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,API_ENDPOINT);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
//turning off the server and peer verification(TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
//NVPRequest for submitting to server
$nvpreq="METHOD=".urlencode($methodName)."&VERSION=".urlencode(VERSION)."&PWD=".urlencode(API_PASSWORD)."&USER=".urlencode(API_USERNAME)."&SIGNATURE=".urlencode(API_SIGNATURE).$nvpStr;
//setting the nvpreq as POST FIELD to curl
curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq);
//getting response from server
$response = curl_exec($ch);
//convrting NVPResponse to an Associative Array
$nvpResArray=$this->deformatNVP($response);
$nvpReqArray=$this->deformatNVP($nvpreq);
$this->paypal_stuff['nvpReqArray']=$nvpReqArray;
if (curl_errno($ch)) {
// moving to display page to display curl errors
$this->paypal_stuff['curl_error_no']=curl_errno($ch) ;
$this->paypal_stuff['curl_error_msg']=curl_error($ch);
$location = "../paypal_error.php";
header("Location: $location");
} else {
//closing the curl
curl_close($ch);
}
return $nvpResArray;
}
Hat jemand ne Idee wie ich die curl funktionen ersetzen kann? Habs mal kurz mit fsockopen() probiert, habe aber das dumme Gefühl dasses damit nicht funktioniert...
Gruß, CS