我正设法建立快春订阅付款处理系统。
我有以下档案,载有2项职能。 第一组通过URL打电话,获取基本秩序信息。 在订购参考中,第二批客户按订单功能返回,并收到一些订阅信息。
这些职能在单独运作时是正确的。 但是,在共同运行时,第二个功能是东北大西洋渔业组织的工作,它正在产生第一件大呼吁的结果?
<?php
//order reference..
$OrderReference = QUI110930-3371-94207B ;
//UNCOMMENT THIS IF JUST WANT TO TEST getSubscriber function on its own..
//$SubscriptionReference1 = QUI110926-3371-68125S ;
getOrder ( $OrderReference );
getSubscription ( $SubscriptionReference1 );
//test our variaables for getOrder..
echo <br/>1: . $OrderReferrer;
echo <br/>2: . $beginDate;
echo <br/>3: . $display;
echo <br/>4: . $value;
echo <br/>5: . $productDisplay;
echo <br/>7: . $SubscriptionReference;
echo <br/><br/><br/> ;
//test our variaables for getSubscriber
echo <br/>1: . $nextPeriodDate;
echo <br/>2: . $subscriptionUrlDetail;
echo <br/><br/><br/> ;
print_r ( $test );
function getOrder($OrderReference) {
$username = my_username ;
$pass = my_password ;
//Initialize handle and set options
$payload = -i -X GET -u . $username . : . $pass;
$requrl = https://api.fastspring.com/company/quizba/order/ . $OrderReference;
define ( XML_PAYLOAD , $payload );
define ( XML_POST_URL , $requrl );
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, XML_POST_URL );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 10 );
curl_setopt ( $ch, CURLOPT_USERPWD, $username . : . $pass );
curl_setopt ( $ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt ( $ch, CURLOPT_HTTPHEADER, array ( Content-type: Application/xml ) );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
//Execute the request and also time the transaction
$result = curl_exec ( $ch );
if ($result == ) {
$result = curl_exec ( $ch );
}
//Check for errors
if (curl_errno ( $ch )) {
$resultMsg = ERROR -> . curl_errno ( $ch ) . : . curl_error ( $ch );
} else {
$returnCode = ( int ) curl_getinfo ( $ch, CURLINFO_HTTP_CODE );
switch ($returnCode) {
case 404 :
$resultMsg = ERROR -> 404 Not Found ;
break;
case 200 :
break;
default :
$resultMsg = HTTP ERROR -> . $returnCode;
break;
}
}
//Assign the variables..
$resultArray = simplexml_load_string ( $result );
global $OrderReferrer;
$OrderReferrer = $resultArray->referrer [0];
global $beginDate;
$beginDate = $resultArray->statusChanged [0]; //needs to be modified..
global $display;
$display = $resultArray->status [0];
global $productDisplay;
$productDisplay = $resultArray->orderItems->orderItem [0]->productDisplay [0];
global $value;
$value = $resultArray->total [0];
global $SubscriptionReference;
$SubscriptionReference = $resultArray->orderItems->orderItem [0]->subscriptionReference [0];
//Close the handle
curl_close ( $ch );
}
//get the subscription details
function getSubscription($SubscriptionReference) {
$username = my_username ;
$pass = my_password ;
$payload = -i -X GET -u . $username . : . $pass;
$requrl = https://api.fastspring.com/company/quizba/subscription/ . $SubscriptionReference;
define ( XML_PAYLOAD , $payload );
define ( XML_POST_URL , $requrl );
$newCh = curl_init ();
curl_setopt ( $newCh, CURLOPT_URL, XML_POST_URL );
curl_setopt ( $newCh, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $newCh, CURLOPT_TIMEOUT, 10 );
curl_setopt ( $newCh, CURLOPT_USERPWD, $username . : . $pass );
curl_setopt ( $newCh, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt ( $newCh, CURLOPT_HTTPHEADER, array ( Content-type: Application/xml ) );
curl_setopt ( $newCh, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt ( $newCh, CURLOPT_SSL_VERIFYPEER, 0 );
//Execute the request and also time the transaction
$newResult = curl_exec ( $newCh );
if ($newResult == ) {
$newResult = curl_exec ( $newCh );
}
//Check for errors
if (curl_errno ( $newCh )) {
$newResultMsg = ERROR -> . curl_errno ( $newCh ) . : . curl_error ( $newCh );
} else {
$returnCode = ( int ) curl_getinfo ( $newCh, CURLINFO_HTTP_CODE );
switch ($returnCode) {
case 404 :
$newResultMsg = ERROR -> 404 Not Found ;
break;
case 200 :
break;
default :
$newResultMsg = HTTP ERROR -> . $returnCode;
break;
}
}
//Assign the variables..
global $test;
$test = $newResult;
//$newResultArray = new SimpleXMLElement($newResult, NULL, FALSE);
$newResultArray = simplexml_load_string ( $newResult );
global $nextPeriodDate;
$nextPeriodDate = $newResultArray->nextPeriodDate [0]; //needs to be modified..
global $subscriptionUrlDetail;
$subscriptionUrlDetail = $newResultArray->customerUrl [0];
//Close the handle
curl_close ( $newCh );
}