starkec Posted October 8, 2007 Share Posted October 8, 2007 Hey guys, I'm trying to use PHP and nuSOAP to send information from my form to this web service on directTrack. The web service even gives me details on what the web service needs from the soap: http://secure.directtrack.com/api/soap.php# (its the addAffiliate one listed). So this gives the SoapAction, endpoint, etc. I have this code below, but I can't seem to get it working. Am I in the right direction? <?php require_once('lib/nusoap.php'); $endpoint = 'http://secure.directtrack.com/api/soap.php'; $namespace = 'http://soapinterop.org//'; $soapAction = 'http://secure.directtrack.com/api/soap.php/addAffiliate'; // Build our paremeter array $FIELDS = array(); $FIELDS['client'] = 'testing'; $FIELDS['password'] = 'test'; $FIELDS['email'] = $_POST['email']; $FIELDS['first_name'] = $_POST['first_name']; $FIELDS['last_name'] = $_POST['last_name']; $FIELDS['company'] = $_POST['company']; $FIELDS['pwd'] = $_POST['pwd']; $FIELDS['address'] = $_POST['address']; $FIELDS['address2'] = $_POST['address2']; $FIELDS['city'] = $_POST['city']; $FIELDS['state'] = $_POST['state']; $FIELDS['country'] = $_POST['country']; $FIELDS['zip'] = $_POST['zip']; $FIELDS['phone'] = $_POST['phone']; $FIELDS['fax'] = $_POST['fax']; $FIELDS['tax_id'] = $_POST['tax_id']; $FIELDS['website'] = $_POST['website']; $FIELDS['website2'] = $_POST['website2']; $FIELDS['website3'] = $_POST['website3']; $soap = new soapclient($endpoint, 'wsdl'); $result = $soap->call('addAffiliate', array('parameters' => $FIELDS), $namespace, $soapAction); echo "request: ".$client->request; if ($client->fault) { echo "SOAP error: ".$result['faultstring']; print_r($result); } else { $err = $client->getError(); if ($err) { echo "SOAP error: ".$err; } else { print_r($result); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72376-php-soap/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.