sessionId = '-1'; $wsdl = new wsdl($soapUrl, '', '', '', '', 5); $this->soapClient = new nusoap_client($wsdl, 'wsdl'); $this->userAuth = array('user_auth' => array('user_name' => "bcunningham", 'password' => "32c318900106acefdd18e5445327dedc", 'version' => '.01'), 'application_name' => "WebsiteLeadGenerator"); // Login to the SOAP server $response = $this->soapClient->call('login', $this->userAuth); if ($response) $this->sessionId = $response['id']; if (!isset($this->sessionId) || $this->sessionId == '-1') { // Error with connection /* JMK: You can put in a nice error page here if you like to explain ** that your currently having problems with the web form and maybe ** give them a phone number */ die("Error connecting to server!"); } else { /* JMK: A successful connection. ** If you ever need to debug, just uncomment and chuck in whatever ** variables you need */ //echo "

Connection Success!

"; } } function addLead($salutation, $first_name, $last_name, $phone_work, $phone_other, $email, $occupation, $description, $referral) { $result = $this->soapClient->call( 'set_entry', array( 'session' => $this->sessionId, 'module_name' => 'Leads', 'name_value_list' => array( array('name' => 'date_entered', 'value' => date("Y-m-d H:i:s")), array('name' => 'date_modified', 'value' => date("Y-m-d H:i:s")), array('name' => 'status', 'value' => 'Web'), array('name' => 'salutation', 'value' => $salutation), array('name' => 'first_name', 'value' => $first_name), array('name' => 'last_name', 'value' => $last_name), array('name' => 'phone_mobile', 'value' => $phone_work), array('name' => 'phone_home', 'value' => $phone_other), array('name' => 'email1', 'value' => $email), array('name' => 'description', 'value' => $description), array('name' => 'referred_by', 'value' => $referral), array('name' => 'lead_source', 'value' => $occupation) ) ) ); if ($result['id'] != '-1') { $newLeadID = $result['id']; /* JMK: The lead was added successfully! ** Now you can decide what you want to do with the person after ** they've filled out the form! */ //echo "

Lead created! ($newLeadID)

"; //echo "
$salutation, $first_name, $last_name, $phone_work, $phone_other,
			//		 $email, $occupation, $description, $referral
"; /* For example, personally I would send them to a Thank You page */ //header('Location: thankyou.html'); header('Location: ../formacknowledge.html'); } else { /* JMK: There were problems adding the lead ** If you ever need to debug, just uncomment. Again you could send ** them to a page to explain there was a problem and provide a phone ** number for them to call. */ //echo "

Problem creating Lead :(

"; //echo "
";
			//print_r($result);
			//echo "
"; } } } ?>