Issue with ADF / XML via PHP - Auto-lead data format

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mobsterstats
Forum Newbie
Posts: 3
Joined: Wed Feb 25, 2009 11:10 am

Issue with ADF / XML via PHP - Auto-lead data format

Post by mobsterstats »

I think I'm having an issue with the content type, encoding, or something... I've tried all kinds of methods of encoding and content types but the lead still comes in as a general "unmatched" email and not as an actual lead. "scratching my head at this one!"

Code: Select all

 
<?
 
$xml = "<?xml version=\"1.0\"?>\n";
$xml .= "<?ADF version=\"1.0\"?>\n";
$xml .= "<adf>\n";
$xml .= "<prospect>\n";
$xml .= "<requestdate>2005-03-22T18:28:28-00:00</requestdate>\n";
$xml .= "<vehicle interest=\"buy\" status=\"used\">\n";
$xml .= "<year>2005</year>\n";
$xml .= "<make>Hummer</make>\n";
$xml .= "<model>H1</model>\n";
$xml .= "<vin>12345123451234512</vin>\n";
$xml .= "<stock>KRS1</stock>\n";
$xml .= "<trim></trim>\n";
$xml .= "<doors</doors>\n";
$xml .= "<bodystyle>Motorcycle</bodystyle>\n";
$xml .= "<transmission</transmission>\n";
$xml .= "<odometer status=\"unknown\" units=\"mi\">0</odometer>\n";
$xml .= "<colorcombination>\n";
$xml .= "<interiorcolor></interiorcolor>\n";
$xml .= "<exteriorcolor></exteriorcolor>\n";
$xml .= "<preference>1</preference>\n";
$xml .= "</colorcombination>\n";
$xml .= "<price type=\"quote\" currency=\"USD\">$0</price>\n";
$xml .= "<option>\n";
$xml .= "<optionname>AM/FM/Cass/CD</optionname>\n";
$xml .= "<weighting</weighting>\n";
$xml .= "</option>\n";
$xml .= "<option>\n";
$xml .= "<optionname>Active Handling</optionname>\n";
$xml .= "<weighting</weighting>\n";
$xml .= "</option>\n";
$xml .= "<option>\n";
$xml .= "<optionname>Adjustable Pedals</optionname>\n";
$xml .= "<weighting</weighting>\n";
$xml .= "</option>\n";
$xml .= "<option>\n";
$xml .= "<optionname>Air Conditioning</optionname>\n";
$xml .= "<weighting</weighting>\n";
$xml .= "</option>\n";
$xml .= "<option>\n";
$xml .= "<optionname>Alloy Wheels</optionname>\n";
$xml .= "<weighting</weighting>\n";
$xml .= "</option>\n";
$xml .= "<comments></comments>\n";
$xml .= "</vehicle>\n";
$xml .= "<customer>\n";
$xml .= "<contact>\n";
$xml .= "<name part=\"first\">TestFirst</name>\n";
$xml .= "<name part=\"last\">TestLast</name>\n";
$xml .= "<email>support@ourdealerwebsite.com</email>\n";
$xml .= "<phone type=\"voice\" time=\"day\"></phone>\n";
$xml .= "<phone type=\"voice\" time=\"evening\">802-658-0965</phone>\n";
$xml .= "<address>\n";
$xml .= "<street line=\"1\"></street>\n";
$xml .= "<street line=\"2\"></street>\n";
$xml .= "<city></city>\n";
$xml .= "<regioncode</regioncode>\n";
$xml .= "<postalcode</postalcode>\n";
$xml .= "<country</country>\n";
$xml .= "</address>\n";
$xml .= "</contact>\n";
$xml .= "<comments>Test time</comments>\n";
$xml .= "</customer>\n";
$xml .= "<vendor>\n";
$xml .= "<id source=\"ourdealerwebsite.com\"</id>\n";
$xml .= "<vendorname>DDC Support Training</vendorname>\n";
$xml .= "<contact>\n";
$xml .= "<name part=\"first\"></name>\n";
$xml .= "<name part=\"last\"></name>\n";
$xml .= "<email>support@ourdealerwebsite.com</email>\n";
$xml .= "<phone type=\"voice\" time=\"day\">555-555-5555</phone>\n";
$xml .= "<phone type=\"voice\" time=\"evening\"></phone>\n";
$xml .= "<address>\n";
$xml .= "<street line=\"1\">1313 Mockingbird Lane</street>\n";
$xml .= "<street line=\"2\"></street>\n";
$xml .= "<city>Burlington</city>\n";
$xml .= "<regioncode>VT</regioncode>\n";
$xml .= "<postalcode</postalcode>\n";
$xml .= "<country>UNITED STATES</country>\n";
$xml .= "</address>\n";
$xml .= "</contact>\n";
$xml .= "</vendor>\n";
$xml .= "<provider>\n";
$xml .= "<name part=\"full\">ourdealerwebsite.com</name>\n";
$xml .= "<service>Test Drive - ourdealerwebsite.com</service>\n";
$xml .= "<url>http://www.ourdealerwebsite.com</url>\n";
$xml .= "<email>support@ourdealerwebsite.com</email>\n";
$xml .= "<phone type=\"voice\">802-658-0965 x102</phone>\n";
$xml .= "<contact>\n";
$xml .= "<name part=\"full\">ourdealerwebsite.com Support</name>\n";
$xml .= "<email>support@ourdealerwebsite.com</email>\n";
$xml .= "<phone type=\"voice\" time=\"day\">802-658-0965 x102</phone>\n";
$xml .= "<address>\n";
$xml .= "<street line=\"1\">431 Pine Street</street>\n";
$xml .= "<city>Burlington</city>\n";
$xml .= "<regioncode>VT</regioncode>\n";
$xml .= "<postalcode>05401</postalcode>\n";
$xml .= "<country>US</country>\n";
$xml .= "</address>\n";
$xml .= "</contact>\n";
$xml .= "</provider>\n";
$xml .= "</prospect>\n";
$xml .= "</adf>\n";
 
// CREATE THE MESSAGE FROM THE XML STUFF AND THE BUFFERED ADF STUFF
$to = "leademail@ourdealerwebsite.com"; // this is where the leads are sent to
$subject = "New Lead From ME - TESTING";
 
$headers = "xml version: 1.0" . "\r\n";
$headers .= "Content-Type: application/xhtml+xml; encoding=ISO-8859-1" . "\r\n";
 
$mail_sent = @mail($to, $subject, $xml, $headers);
echo $mail_sent ? '<font color="#ff0000">Form data sent successfully to CRM Tool!</font>' : '<font color="#ff0000">Auto lead failed - message not sent!</font>';
 
?>
 
I'm not sure if it's an encoding issue or what... but I am following the ADF/XML guidelines to a "T" and this is still coming in as an email and not an XML lead?

Any help would be much appreciated!
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Issue with ADF / XML via PHP - Auto-lead data format

Post by pickle »

I'm not quite sure exactly what the problem is. Could you explain it further?

Also, use heredocs to create your XML, rather than a bunch of individual lines. You might also want to take off the '@' in front of your mail() call - just in case there's a problem with it.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
mobsterstats
Forum Newbie
Posts: 3
Joined: Wed Feb 25, 2009 11:10 am

Re: Issue with ADF / XML via PHP - Auto-lead data format

Post by mobsterstats »

The auto leads come in either as xml/adf leads or just general emails.

I'm trying to get the leads to enter our internet lead management software as leads rather that emails.

I'm pretty sure it's an encoding, content-type, or some other weird glitch. My adf/xml
format "markup" is perfect. So still don't know why it's not working.

This is what my headers look like after talking with software support!

Code: Select all

 
 
$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";
 
 
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Issue with ADF / XML via PHP - Auto-lead data format

Post by pickle »

What's a "lead"?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
lawlcatz
Forum Newbie
Posts: 1
Joined: Wed Mar 25, 2009 2:23 pm

Re: Issue with ADF / XML via PHP - Auto-lead data format

Post by lawlcatz »

Code: Select all

 
<?php
$vendor="\t\t\t\t<contact>\n\n\t\t\t<name part=\"full\">".$home."</name>\n\n\t\t\t</contact>\n\n\t\t";
$vehicle= "\t\t\t<year>".$year."</year>\n\n\t\t\t<make>".$make."</make>\n\n\t\t\t<model>".$model."</model>\n\n";
$customer= "<contact>\n\n\t\t\t\t<name part=\"full\">".$name."</name>\n\n\t\t\t\t<email>".$email."</email>\n\n\t\t\t\t<phone type=\"phone\">".$phone."</phone>\n\n\t\t\t\t<address type=\"home\">".$address."</address>\n\n\t\t\t</contact>\n\n\t\t\t<comments>".$info."</comments>\n\n";
$adf= "<?ADF VERSION \"1.0\"?>\n\n<?XML VERSION \"1.0\"?>\n\n<adf>\n\n\t<prospect>\n\n\t\t<id source=\"".$source."\"></id>\n\n\t\t<requestdate>".$timestamp."</requestdate>\n\n\t\t<vehicle>\n\n".$vehicle."\t\t</vehicle>\n\n\t\t<customer>\n\n\t\t\t".$customer."\t\t</customer>\n\n\t\t<vendor>\n\n\t\t\t".$vendor."</vendor>\n\n\t</prospect>\n\n</adf>";
$body=$adf;
$header = "From: <". $email . ">\r\n";
if (mail($addresse, $subject, $body, $header)) 
      {
      } else 
      {
        print "Message delivery failed...";
      }
?>
Something that has worked for me.
foaad
Forum Newbie
Posts: 1
Joined: Sun Apr 19, 2009 1:36 pm

Re: Issue with ADF / XML via PHP - Auto-lead data format

Post by foaad »

Has this issue been resolved? I am having the same issue and I am hoping that someone can help me as there are not enough resources out there.
Post Reply