[英]icontact add contact PHP API
我正在嘗試使用iContact的PHP Api來存儲聯系人。 我已經注冊了帳戶,正在使用iContact提供的GitHub上的iContactApi.php。
我的源代碼看起來像這樣
// Load the iContact library
require_once('ws/iContactApi.php');
// Give the API your information
iContactApi::getInstance()->setConfig(array(
'appId' => 'myappID',
'apiPassword' => 'myuser',
'apiUsername' => 'mypass'
));
// Store the singleton
$oiContact = iContactApi::getInstance();
// Try to make the call(s)
//try {
// are examples on how to call the iContact PHP API class
// Create a contact
var_dump($oiContact->addContact('joe@shmoe.com', null, null, 'Joe', 'Shmoe', null, '123 Somewhere Ln', 'Apt 12', 'Somewhere', 'NW', '12345', '123-456-7890', '123-456-7890', null));
//}
我收到以下錯誤:
致命錯誤:未捕獲的異常“ Exception”,消息為“錯誤已發生,系統無法繼續。 有關詳細信息,請使用getErrors()。 在C:\\ xampp \\ htdocs \\ clydebutcher \\ ws \\ iContactApi.php:482堆棧跟蹤中:#0 C:\\ xampp \\ htdocs \\ clydebutcher \\ ws \\ iContactApi.php(1096):iContactApi-> makeCall('/ a /' ,'get',NULL,'accounts')#1 C:\\ xampp \\ htdocs \\ clydebutcher \\ ws \\ iContactApi.php(212):iContactApi-> setAccountId()#2 C:\\ xampp \\ htdocs \\ clydebutcher \\ mdl- newsletter-save.php(130):iContactApi-> addContact('joe@shmoe.com',NULL,NULL,'Joe','Shmoe',NULL,'123 Somewhere L ...','Apt 12', 'Somewhere','NW','12345','123-456-7890','123-456-7890',NULL)#3 C:\\ xampp \\ htdocs \\ clydebutcher \\ mdl.php(14):include( 'C:\\ xampp \\ htdocs ...')#4 C:\\ xampp \\ htdocs \\ clydebutcher \\ index.php(13):include('C:\\ xampp \\ htdocs ...')#5 {main}拋出在482行上的C:\\ xampp \\ htdocs \\ clydebutcher \\ ws \\ iContactApi.php中
我做錯什么了嗎?
您想使用iContact API中的getError()方法來查找有關所發生情況的更多信息。
try {
// Give the API your information.
iContactApi::getInstance()->setConfig(array(
'appId' => 'myid',
'apiPassword' => 'mypassword',
'apiUsername' => 'mysecret',
));
// Store the singleton
$oiContact = iContactApi::getInstance();
// Create a contact
var_dump($oiContact->addContact('joe@shmoe.com', null, null, 'Joe', 'Shmoe', null, '123 Somewhere Ln', 'Apt 12', 'Somewhere', 'NW', '12345', '123-456-7890', '123-456-7890', null));
}
catch (Exception $e) {
print_r($oiContact->getErrors();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.