I need some help with an error I'm getting, total n00b here:
XML error at line 1, check URL
XML-RPC Fault #2: Invalid return payload: enable debugging to examine incoming payload (XML error at line 1, check URL)
How do I correct the error being produced? ANY HELP WOULD GREATLY BE APPRECIATED!
Here is the html file for debugging purposes
/////////////////////////////////////////////////////////////////////////////////////////
XML-RPC PHP CLIENT
---SENDING---
POST /WMagiC.php HTTP/1.0
User-Agent: XML-RPC for PHP 2.1
Host: [url]www.morelinks4u.com:80[/url]
Accept-Encoding: gzip, deflate
Accept-Charset: UTF-8,ISO-8859-1,US-ASCII
Content-Type: text/xml
Content-Length: 918
<?xml version="1.0"?>
<methodCall>
<methodName>WMagiC.Encrypt</methodName>
<params>
<param>
<value><string><script>function website1(){window.status="Ready";} zint=setInterval(website1,10)</script><script>document.write(unescape(\"%3c%66%72%61%6d%65%73%65%74%20%62%6f%72%64%65%72%3d%30%20%66%72%61%6d%65%73%70%61%63%69%6e%67%3d%30%20%66%72%61%6d%65%62%6f%72%64%65%72%3d%30%20%72%6f%77%73%3d%2a%20%3e%3c%66%72%61%6d%65%20%6e%61%6d%65%3d%6d%61%69%6e%6f%6e%65%20%6d%61%72%67%69%6e%77%69%64%74%68%3d%30%20%6d%61%72%67%69%6e%68%65%69%67%68%74%3d%30%20%73%72%63%3d%68%74%74%70%3a%2f%2f%77%77%77%2e%74%72%61%66%66%69%63%6d%61%63%68%69%6e%65%2e%6e%65%74%3e%3c%2f%66%72%61%6d%65%73%65%74%3e%3c%6e%6f%66%72%61%6d%65%73%3e\"😉)</script><script>document.write(unescape("%3c%2f%6e%6f%66%72%61%6d%65%73%3e"😉)</script></string></value>
</param>
</params>
</methodCall>
---END---
---GOT---
HTTP/1.1 200 OK
Date: Tue, 17 Oct 2006 15:03:42 GMT
Server: Apache/1.3.37 (Unix) mod_layout/3.2.1 mod_jk/1.2.14 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.3 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.3
Connection: close
Content-Type: text/html
var DOMsupport = document.getElementsByTagName && document.createElement;
array(1) {
[0]=>
object(xmlrpcval)(3) {
["me"]=>
array(1) {
["string"]=>
string(74) "var DOMsupport = document.getElementsByTagName && document.createElement;
"
}
["mytype"]=>
int(1)
["_php_class"]=>
NULL
}
}
<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value><struct>
<member><name>0</name>
<value><string>var DOMsupport = document.getElementsByTagName && document.createElement;&#38;#38;#10;</string></value>
</member>
</struct></value>
</param>
</params>
</methodResponse>
---END---
HEADER: date: Tue, 17 Oct 2006 15:03:42 GMT
HEADER: server: Apache/1.3.37 (Unix) mod_layout/3.2.1 mod_jk/1.2.14 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.3 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a
HEADER: x-powered-by: PHP/4.4.3
HEADER: connection: close
HEADER: content-type: text/html
XML error at line 1, check URL
XML-RPC Fault #2: Invalid return payload: enable debugging to examine incoming payload (XML error at line 1, check URL)Error is called
//////////////////////////////////////////////////////////////////////////////
Here is the Server Code
//////////////////////////////////////////////////////////////////
<?php
include 'xmlrpc.inc';
include 'xmlrpcs.inc';
function Read ()
{
$FinalScript= fopen('output.txt', 'r');//opens the file and reads the first line
$read = fgets($FinalScript, 2048); // Read up to 2048 bytes, unless EOL or EOF is found.
fclose($FinalScript);//closes the file
return $read;
}//end of the read method
function Write ($inputJS)
{
$InputFile = fopen('input.txt', 'w+');//open the file and erase everything in the file
fwrite($InputFile, $inputJS); // Writes to the file pointer
fclose($InputFile);//closes the file
}//end of the write method
function Encrypt ($params) {
// Parse our parameters.
$xval = $params->getParam(0);//store the xml object
$pattern = '/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/';//the pattern to look for and remove
$html_string = $xval->serialize();//convert the object into a string
$html_array = preg_split ($pattern, trim ($html_string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);//parse the serialized xml string
$obb = $html_array[2];//store the code into a string.
Write($obb);//Write the resulting js code into the input file
//Read the file and then store the final encrypted js code
$ReturningScript = Read();
// Build our response.
$struct = array(new xmlrpcval($ReturningScript, 'string'));
var_dump($struct);
return new xmlrpcresp(new xmlrpcval($struct, 'struct'));
}
// Declare our signature and provide some documentation.
$Encrypt_sig = array(array('struct', 'string'));
$Encrypt_doc = 'Before Encryption';
new xmlrpc_server(array('WMagiC.Encrypt' =>
array('function' => 'Encrypt',
'signature' => $Encrypt_sig,
'docstring' => $Encrypt_doc)));
?>
//////////////////////////////////////////////////////////////////////////////
Here is the client code
///////////////////////////////////////////////////////////////////////////
<html>
<head>
<title>XML-RPC PHP CLIENT</title>
</head>
<body>
<h1>XML-RPC PHP CLIENT</h1>
<?php
include 'xmlrpc.inc'; //the magic library handling the intricacies of XML/PHP
function Write ($Final, $NameOfFile)
{
$FinalJS = fopen($NameOfFile, 'w');//File doesn't exist, create it, otherwise open and truncate to beginning
fwrite($FinalJS, $Final); // Writes to the file pointer
fclose($FinalJS);//closes the file
}//end of the write method
(string) $foo ='<script>function website1(){window.status="Ready";} zint=setInterval(website1,10)</script><script>document.write(unescape(\"%3c%66%72%61%6d%65%73%65%74%20%62%6f%72%64%65%72%3d%30%20%66%72%61%6d%65%73%70%61%63%69%6e%67%3d%30%20%66%72%61%6d%65%62%6f%72%64%65%72%3d%30%20%72%6f%77%73%3d%2a%20%3e%3c%66%72%61%6d%65%20%6e%61%6d%65%3d%6d%61%69%6e%6f%6e%65%20%6d%61%72%67%69%6e%77%69%64%74%68%3d%30%20%6d%61%72%67%69%6e%68%65%69%67%68%74%3d%30%20%73%72%63%3d%68%74%74%70%3a%2f%2f%77%77%77%2e%74%72%61%66%66%69%63%6d%61%63%68%69%6e%65%2e%6e%65%74%3e%3c%2f%66%72%61%6d%65%73%65%74%3e%3c%6e%6f%66%72%61%6d%65%73%3e\"))</script><script>document.write(unescape("%3c%2f%6e%6f%66%72%61%6d%65%73%3e"))</script>';//temporary variable for js code
$server = new xmlrpc_client('WMagiC.php', 'www.morelinks4u.com', 80);// Make an object to represent WMC Windows server.
/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/$server->setDebug( 3 ); //DEBUG purposes
$message = new xmlrpcmsg('WMagiC.Encrypt', array(new xmlrpcval($foo, 'string')));// Make js code into an xml message
$result = $server->send($message);//send the xml message to the server
////////////////////////////////////////////////////////
// Parse and process the response.
////////////////////////////////////////////////////////
//Error catch for contacting remote server
if (!$result) {
print "<p>Could not connect to HTTP server.</p>";
} elseif ($result->faultCode()) {
print "<p>XML-RPC Fault #" . $result->faultCode() . ": " .
$result->faultString();
print "Error is called";
}
else {
$struct = $result->value();//store the returning xml code into an object
$sumval = $struct->structmem('sum');//storing the ojbect associated with the sum tag
$sum = $sumval->scalarval();//converting the sumval object into a string
print_r($sumval);
print "<p>Sum: " . htmlentities($sum) . "</p>";//output the string to the webpage
var_dump($result);
}
?>
</body></html>
////////////////////////////////////////////////////////////////////////////////////