MyPW PHP - Updated IXR with SSL support

92 views
Skip to first unread message

Jason K

unread,
May 6, 2007, 9:54:03 PM5/6/07
to MyPW Developers, si...@simonwillison.net
The current IXR (Incutio XML-RPC) library for PHP does not seem to
support HTTP/SSL connections to the XML-RPC server. See below for a
slightly modified version of this library along with a snippet of the
sample code we are using to authenticate against MyPW over SSL.
Please note that this code requires PHP 4.3.0 or higher and PHP with
OpenSSL support, or else fsockopen will fail to connect to the SSL
server. Output from diff against the original IXR v1.61 file is also
shown at the end of the message.

Updated IXR Library:
http://gpl.datility.net/jrk/contrib/IXR_Library.inc.phps

Example IXR call for MyPW:
http://gpl.datility.net/jrk/contrib/IXR_Library.mypw-example.phps

It does not seem that the IXR library is actively developed. However,
anyone involved in the IXR library is welcome to integrate these
changes in part or in whole.

Jason


diff IXR_Library.inc.php-1.61-jrk IXR_Library.inc.php-1.61-orig
11,13d10
< /*
< Modified by Jason Klein (06/May/2007) to support HTTPS scheme.
< */
479,480c476
< $this->ssl = ($bits['scheme'] == 'https' ? 'ssl://' : '');
< $this->port = isset($bits['port']) ? $bits['port'] :
($bits['scheme'] == 'https' ? 443 : 80);
---
> $this->port = isset($bits['port']) ? $bits['port'] : 80;
487d482
< $this->ssl = '';
511c506
< $fp = @fsockopen( $this->ssl . $this->server , $this->port,
$errno, $errstr, 30);
---
> $fp = @fsockopen($this->server, $this->port);
513c508
< $this->error = new IXR_Error(-32300, 'transport error -
could not open socket [' . $errstr . ':' . $errno . ']');
---
> $this->error = new IXR_Error(-32300, 'transport error - could not open socket');

Reply all
Reply to author
Forward
0 new messages