Jump to content

php xml problem - dotgo


cwilliams

Recommended Posts

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

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();

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.