You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Help! can not save contact using php connect api

Received Response
10
Views
1
Comments
edited Sep 4, 2018 7:02AM in Agent Desktop 1 comment

Content

Hello everyone

I want create a contact using php connect api, So I wrote code in customer portal as below :

$contact = new RNCPHP\Contact();
$contact->Title = ""; 
//add email addresses
$email_addr=$zykh."@com.invalid";
$contact->Emails = new RNCPHP\EmailArray();
$contact->Emails[0] = new RNCPHP\Email();
$contact->Emails[0]->AddressType=new RNCPHP\NamedIDOptList(); 
$contact->Emails[0]->AddressType->LookupName = "Email - Primary";
$contact->Emails[0]->Address = "[email protected]";   
$contact->save();
 
when the php run , it shows error message as below:
Invalid ID:ID could not be resolved from the lookupName[Email - Primary];
 
But the  php connect  api document wrote code like this,what's wrong with my code? Can you give me some suggestion? 

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!