cwilliams Posted February 4, 2011 Share Posted February 4, 2011 Hi, I'm having a problem with getting a engine working with dotgo.com. When I send the short text to have the message sent, I get back a message from dotgo that the engine has a xml format problem. <?xml version="1.0" encoding="UTF-8"?> <cmrl xmlns:dotgo="http://dotgo.com/cmrl/1.0"> <match pattern="test"> <engine href="http://site.com/engine.php" /> </match> </cmrl> The engine gets a name from a file and generates a random set of characters then displays the name and generated characters. At least in theory Example of the result: <message><content>Tom Smith Validation Code - SHRSD</content></message> How can I make the output dotgo compatible? <?php $owner = file_get_contents("owner.txt"); function createRandomPassword() { $chars = "ABCDEFGHIJKMNOPQRSTUVWXYZ"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i <= 4) { $num = rand() % 24; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } // Usage $password = createRandomPassword(); $message = <<<XML <message><content>$owner example text - $password</content></message> XML; print $message; ?> Link to comment https://forums.phpfreaks.com/topic/226717-php-xml-problem-dotgo/ Share on other sites More sharing options...
Maq Posted February 4, 2011 Share Posted February 4, 2011 (Please use tags next time, thx) Link to comment https://forums.phpfreaks.com/topic/226717-php-xml-problem-dotgo/#findComment-1170010 Share on other sites More sharing options...
spfoonnewb Posted February 5, 2011 Share Posted February 5, 2011 I assume this is due to the output not being XML? <?php function createRandomPassword() { $chars = "ABCDEFGHIJKMNOPQRSTUVWXYZ"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i <= 4) { $num = rand() % 24; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } // Usage $password = createRandomPassword(); $xml = new SimpleXMLElement("<message></message>"); $xml->content = "{$owner} example text - {$password}"; print $xml->asXML(); ?> Link to comment https://forums.phpfreaks.com/topic/226717-php-xml-problem-dotgo/#findComment-1170105 Share on other sites More sharing options...
cwilliams Posted February 5, 2011 Author Share Posted February 5, 2011 That was the problem. Thank you! Link to comment https://forums.phpfreaks.com/topic/226717-php-xml-problem-dotgo/#findComment-1170124 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.