dosryjij88555 2014-03-17 11:40
浏览 35

icontact添加联系人PHP API

I am trying to use PHP Api from iContact to store a contact. I have registered the account, I am using the iContactApi.php from GitHub provided by iContact.

My sourcecode looks like thisL

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

//}

I get the following error:

Fatal error: Uncaught exception 'Exception' with message 'Errors have occurred and the system cannot continue. Use getErrors() for details.' in C:\xampp\htdocs\clydebutcher\ws\iContactApi.php:482 Stack trace: #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} thrown in C:\xampp\htdocs\clydebutcher\ws\iContactApi.php on line 482

Am I making something wrong?

  • 写回答

1条回答 默认 最新

  • dongniaocheng3773 2015-05-26 23:56
    关注

    You want to use the getError() method from the iContact API to find out more information about what happened.

      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();
      }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测