I don’t know if this is still monitored, but I could really use some help – this stuff is driving me NUTS! I am not getting back any info and I know that there are 3 records that would match. Also, when I put in information – it’s not entering the email address. Here’s my code:

require_once(‘inc/nusoap/nusoap.php’);

class SugarSoap{
var $proxy;
var $sess;

function SugarSoap($soap_url,$login=true){
$soapclient = new soapclient($soap_url,true);
$this->proxy = $soapclient->getProxy();
if($login) $this->login();
}

function login(){
$params = array(
‘user_name’ => ‘uname’,
‘password’ => md5(‘password’),
‘version’ => ‘.01′
);
$result = $this->proxy->login($params,’MyApp’);
$this->sess= $result[‘error’][‘number’]==0 ? $result[‘id’] : null;
return $this->sess;
}
function getContacts($query=”,$maxnum=5,$orderby=’ last_name asc’){

$result = $this->proxy->get_entry_list(
$this->sess,
‘Contacts’,
$query,
“”,
0,
array(
‘id’,
‘first_name’,
‘last_name’,
’email1′
),
$maxnum,
false
);
return $result;
}
function nameValuePairToSimpleArray($array){
$my_array=array();
while(list($name,$value)=each($array)){
$my_array[$value[‘name’]]=$value[‘value’];
}
return $my_array;
}
function setEntry($module,$array){
$data_array=array();
while(list($name,$value)=each($array)){
$data_array[]= array(
‘name’ => $name,
‘value’ => $value );
}
$result = $this->proxy->set_entry(
$this->sess,
$module,
$data_array );
return $result;
}
function setContact($array){
return $this->setEntry(“Contacts”,$array);
}
function createUser($email,$lname,$fname,$utype,$school,$leadsrc){
return $this->setContact(array(
“email1” => $email,
“last_name” => $lname,
“first_name” => $fname,
“usertype_c” => $utype,
“school_c” => $school,
“lead_source” => $leadsrc ));
}
}

$soap=new SugarSoap(‘http://agame.sugarondemand.com/soap.php?wsdl’); // we automatically log in

$result=$soap->getContacts(‘ email1 like “%”‘,5,” last_name desc”);
print_r($result);
if($result[‘result_count’]>0){
foreach($result[‘entry_list’] as $record){
$array= $soap->nameValuePairToSimpleArray($record[‘name_value_list’]);
echo $array[‘first_name’] . ” ” . $array[‘last_name’] . ” – ” . $array[’email1′]. “
“;
}
} else {
echo “No contacts found”;
}
$result=$soap->createUser(’[email protected]’,’Lastname’,’Firstname’,’Employer’,’Somewhere’,’Campaign’);