How do a do an XML Dump on this php file?



Total newbie question, I know...


How do I do an XML dump to see the XML request that this php file is making? I've been trying var_dump and printr in various places and failing miserably....


I am getting an error when submitting this form. When asking the people that run this API, they said they need a XML dump of my request to track the problem down. If there is more specific info needed, or if I need to include and of the /includes/ files, please let me know. I'm new to XML and trying to learn.


When I put var_dump($cdsHtml); after the line echo($cdsHtml); I just get: string(76) " ID Name 0

"


How can I see this in XML format?



<?php

require_once("../includes/classService2.php");

if (!isset($_POST['submit'])) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://ift.tt/15udxSm strict.dtd">
<html>
<head>
<title>List Class Descriptions Demo</title>
<link rel="stylesheet" type="text/css" href="../styles/site.css" />
</head>

<body>
<form method="post" action="getClassDescriptions2.php">
Source Name:
<input type="text" size="25" name="sName"/><br/>
Password:
<input type="password" size="25" name="password"/><br/>
SiteID:
<input type="text" size="5" name="siteID" value="175259"/><br/>
<input type="submit" value="submit" name="submit"/>
</form>
<?php
} else {
$sourcename = $_POST["sName"];


$password = $_POST["password"];
$siteID = $_POST["siteID"];


// initialize default credentials


$creds = new SourceCredentials($sourcename, $password, array($siteID));

$classService = new MBClassService();
$classService->SetDefaultCredentials($creds);

$result = $classService->GetClassDescriptions(array(), array(), array(), null, null, 10, 0);

$cdsHtml = '<table><tr><td>ID</td><td>Name</td></tr>';
$cds = toArray($result->GetClassDescriptionsResult->ClassDescriptions->ClassDescription);
foreach ($cds as $cd) {
$cdsHtml .= sprintf('<tr><td>%d</td><td>%s</td></tr>', $cd->ID, $cd->Name);
}
$cdsHtml .= '</table>';

echo($cdsHtml);
}
?>
</body>
</html>

No comments:

Post a Comment