cancel
Showing results for 
Search instead for 
Did you mean: 

400 error phpWrapper: SOLVED

Highlighted
Occasional Contributor

400 error phpWrapper: SOLVED

UPDATE: SOLVED

Did not realize I had to set the email address even if it was staying the same.

WHERE ARE THE DOCS?

 

I keep getting a 400 error on this.

also, I've been looking everywhere for documentation on the wrapper...can't find anything.

 

$search[0][0]->getLink() returns what I expect

print_r($contact) returns what I expect, but

echo $return always returns 400.

 

<?php require_once("ctctWrapper.php");?>
<?php
updateContact($row_myserinfo);
?>
<?php

function updateContact($custinfo){
//Create search object and search cc lists for user 
  	   $contacts = new ContactsCollection();
  		$search = $contacts->searchByEmail($custinfo['UserEmail']);
		//echo "email address here>".$custinfo['UserEmail'];
		
		print_r($search);


//Get resources of contact we found
	
	$contactId = $search[0][0]->getId();
	
	echo "contact id here>".$contactId;
	     
	     		$contact = new Contact();
	     		$contact->setId($contactId);
	     		$contact->setLink($search[0][0]->getLink());
	 		   
				$contact->setFirstName($custinfo['FirstName']);
				$contact->setLastName($custinfo['LastName']);
				$contact->setAddr1($custinfo['address1']);
				$contact->setAddr2($custinfo['address2']);
  				$contact->setCity($custinfo['city']);
  				$contact->setStateCode($custinfo['state']);
  				
  				$contact->setPostalCode($custinfo['zip']);
	  
	   
	  
			
				
//Create Collection object and send update request 	
 	$collection = new ContactsCollection();
 	$return = $collection->updateContact($contactId,$contact);
 
	 echo $return;
	 print_r ($contact);
}

mysql_free_result($myserinfo);