[eluser]Unknown[/eluser]
Solved: I thought the error was regarding the returned data, but it's actually about sending $request as a blank string parameter instead of as a blank array. Changing $request='' to $request=array() fixed the problem.
I'm trying to use the XML-RPC library to get a cookie value from livejournal.com. The getchallenge method doesn't require any parameters. Through
$this->xmlrpc->set_debug(TRUE), I can see that the server is returning the correct data. However, CI's Xmlrpc.php keeps throwing an error because the data returned is not an array.
My questions:
Why is Xmlrpc.php expecting an array instead of the XML string that's actually returned?
How can I get around this error and actually use the data that's being returned?
Much thanks for any help!
Error:
Code:
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: libraries/Xmlrpc.php
Line Number: 209
Returned from server:
Code:
---HEADERS---
HTTP/1.0 200 OK
Date: Wed, 23 Sep 2009 03:30:43 GMT
Server: Apache
Set-Cookie: ljuniq=VyFuIsC8VNG9daa:1253676643:pgstats0:m0; expires=Sunday, 22-Nov-2009 03:30:43 GMT; domain=.livejournal.com; path=/
Content-Length: 510
Content-Type: text/xml
SOAPServer: SOAP::Lite/Perl/0.60
Connection: close
---END HEADERS---
---DATA---
<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>auth_scheme</name><value><string>c0</string></value></member><member><name>server_time</name><value><int>1253676643</int></value></member><member><name>challenge</name><value><string>c0:1253674800:1843:60:BV9RGJxRODz3O5IFy8YN:2cd6ceeb986bbbdb7ec59903c99cea2c</string></value></member><member><name>expire_time</name><value><int>1253676703</int></value></member></struct></value></param></params></methodResponse>
---END DATA---
Code in my controller:
Code:
$this->load->library('xmlrpc');
$this->xmlrpc->server('http://www.livejournal.com/interface/xmlrpc', 80);
$this->xmlrpc->method('LJ.XMLRPC.getchallenge');
$request = '';
$return = $this->xmlrpc->request($request);
$this->xmlrpc->display_response();
if ( ! $this->xmlrpc->send_request())
{
echo $this->xmlrpc->display_error();
}