Tuesday, October 25, 2011

ADF / XML via PHP - Auto-lead data format


$xmladf='<?ADF VERSION "1.0"?>'. "\r\n";
$xmladf.='<?XML VERSION "1.0"?>'. "\r\n";
$xmladf.='<adf>'. "\r\n";
$xmladf.='<prospect>'. "\r\n";
$xmladf.='<requestdate>'.date(DATE_ATOM).'</requestdate>'. "\r\n";
$xmladf.='<vehicle>'. "\r\n";
$xmladf.='<year>'.$Year.'</year>'. "\r\n";
$xmladf.='<make>'.$Make.'</make>'. "\r\n";
$xmladf.='<model>'.$Model.'</model>'. "\r\n";
$xmladf.='<vin>'.$Vin.'</vin>'. "\r\n";
$xmladf.='</vehicle>'. "\r\n";
$xmladf.='<customer>'. "\r\n";
$xmladf.='<contact>'. "\r\n";
$xmladf.='<name part="full">'.$CustomerFirst </name>'. "\r\n";
$xmladf.='<phone>'.$CustomerPhone.'</phone>'. "\r\n";
$xmladf.='<email>'.$customeremail.'</email>'. "\r\n";
$xmladf.='<address type="home">'. "\r\n";
$xmladf.='<city>'.$CustomerCity.'</city>'. "\r\n";
$xmladf.='<regioncode>'.$CustomerState.'</regioncode>'. "\r\n";
$xmladf.='<postalcode>'.$CustomerZip.'</postalcode>'. "\r\n";
$xmladf.='</address>'. "\r\n";
$xmladf.='</contact>'. "\r\n";
$xmladf.='</customer>'. "\r\n";
$xmladf.='<vendor>'. "\r\n";
$xmladf.='<contact>'. "\r\n";
$xmladf.='<name part="full">'.$vendorname.'</name>'. "\r\n";
$xmladf.='</contact>'. "\r\n";
$xmladf.='</vendor>'. "\r\n";
$xmladf.='<provider>';
$xmladf.='<name part="full">triple tech soft</name>'. "\r\n";
$xmladf.='<service>triple tech soft</service>'. "\r\n";
$xmladf.='<url>http://tripletechsoft.com</url>'. "\r\n";
$xmladf.='<email>test@tripletechsoft.com</email>'. "\r\n";
$xmladf.='<phone>100-222-4444</phone>'. "\r\n";
$xmladf.='</provider>'. "\r\n";
$xmladf.='</prospect>'. "\r\n";
$xmladf.='</adf>'. "\r\n";
//
// CREATE THE MESSAGE FROM THE XML STUFF AND THE BUFFERED ADF STUFF 
$subject = "triple tech soft"; 

 
$headers .= "xml version: 1.0" . "\r\n";
$headers .= "Content-Type: application/xhtml+xml; charset=ISO-8859-1" . "\r\n"; //  encoding=ISO-8859-1
$headers .= 'Content-Transfer-Encoding: 7bit' . "\r\n\r\n";

$mail_sent = @mail($adfemailto, $subject, $xmladf, $headers);
   echo '[success: true, message: "message sent"]';

1 comment:

The Seeker said...

Thanks a lot!
It's very useful.