检索特定用户ID

时间:2016-01-10 10:33:34

标签: php xml-rpc infusionsoft

我想要解除订阅数据,例如

联络ID

SubscriptionPlanId

开始日期

结束日期

NextBillDate

状态

所以我创建了一个代码

/* */
###Include our XMLRPC Library###
###Set our Infusionsoft application as the client###
$client = new xmlrpc_client("https://ab2134.infusionsoft.com/api/xmlrpc");
###Return Raw PHP Types###
$client->return_type = "phpvals";
###Dont bother with certificate verification###
$client->setSSLVerifyPeer(FALSE);
###Build a Key-Value Array to store a contact###
$contact = array('Id','StartDate','EndDate','Status');
//$infusionemail=$this->SanitizeForSQL($emails);
$infusionemail="abhilashrajr.s@gmail.com";
###Set up the call###
$call = new xmlrpcmsg("DataService.findByField", array(
php_xmlrpc_encode($this->infusion_api), #The encrypted API key
php_xmlrpc_encode("RecurringOrder"), 
php_xmlrpc_encode("50"),
php_xmlrpc_encode("50"),
php_xmlrpc_encode("Id"),
php_xmlrpc_encode("15963"), 
//php_xmlrpc_encode($infusionemail),
php_xmlrpc_encode($contact) #The contact array
));
###Send the call###
$result = $client->send($call);
$resultArray = $result->value();
/**/###Check the returned value to see if it was successful and set it to a variable/display the results###
echo "Infusion ID=".$resultArray[0]['Id']."<br/>Infusion Start date=".$resultArray[0]['StartDate']."<br/>Infusion EndDate=".$resultArray[0]['EndDate']."<br/>Infusion Status=".$resultArray[0]['Status'];
}

它没有返回任何东西,任何人都可以帮助我

1 个答案:

答案 0 :(得分:0)

使用现有的Infusionsoft API库,而不是尝试手动创建XML RPC调用,这将更容易。在这里查看伟大的开发资源:   https://developer.infusionsoft.com/docs/xml-rpc/#data-find-a-record-by-matching-a-specific-field

例如,使用SDK,您可以尝试:

$app = new iSDK();
// perform authorization tasks

$returnFields = array('Id','StartDate','EndDate','Status');
$orders = $app->dsFind('RecurringOrder',5,0,'Id',15963,$returnFields);

最后,无论您选择哪种方法,都要检查返回的错误,因为它们经常会告诉您问题所在! :)