Recently, I have updated my site using an SSL and all URIs are now “https://”.
My site is developed with Symfony 2 and mixing a WordPress installation inside Symfony 2 web/wordpress
directory.
All regular access is fine. Only one question:
In my Symfony 2, there is this code snippet:
private function getRecentPosts($num = 4)
{
require_once 'wordpress/wp-includes/class-IXR.php';
$user = '11111';
$pwd = '22222';
$host='https://www.rsywx.net';
$script='/wordpress/xmlrpc.php';
$port=443;
$client = new IXR_Client($host, $script, $port);
$params = array(0, $user, $pwd, $num);
$client->query('metaWeblog.getRecentPosts', $params);
$wp = $client->getResponse();
return $wp;
}
When my site is not wrapped with https, the above code works fine. But now it is under https, the above code is not working. If I dump the $client
variable after the query
function call, it gives an error like:
+error: IXR_Error {#256 â¼
+code: -32300
+message: "transport error - could not open socket"
Any hints? Do I need to tweak my WP?
The problem was on the file wp-includes/class-IXR.php, it doesn’t work with HTTPS, you must use also class-wp-http-ixr-client.php . And don’t forget to include the configuration file wp-load.php.
The code snippet will be:
I just avoided using XMLRPC at all to solve this.
In my Symfony 2 application, I just used a 2nd database to directly access the underlying wordpress database. It is a hack but it resolves my issue for the time being.