Jump to content

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

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.