Monday, March 13, 2017

Can't Use full url in rpc client

I'm using this :

https://packagist.org/packages/comodojo/metaweblog

to build something for posting to blogging services using an API.
I'm currently using laravel for developing this application.
However, When I use something like :

$mwlog = new \Comodojo\MetaWeblog\MetaWeblog( 'http://example.org/services/metablog.ashx', "username", "password" );
    $posts = $mwlog->getRecentPosts(10);
    print $posts;

It returns :

RpcException in RpcClient.php line 511:
request contains int value where string expected [request : parameter 1]

in RpcClient.php line 511
at RpcClient->xmlCall(array('METHOD' => 'metaWeblog.getRecentPosts', 'PARAMETERS' => array(0, 'username', 'password', 10), 'ID' => false)) in RpcClient.php line 284
and so on ...

But when I use something like : "example.org" as the first parameter, it returns :

HttpException in Httprequest.php line 212:
Invalid remote address
in Httprequest.php line 212
at Httprequest->setHost('example.org/services/metablog.ashx') in Httprequest.php line 175

What's going on here?! I don't understand. Please help :)



via M. Safari

Advertisement