CodeIgniter Forums
XMLRPC over https - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: XMLRPC over https (/thread-73454.html)



XMLRPC over https - finhawkman - 04-25-2019

Hello...
.
I having problem when use xmlrpc on client which will access XMLRPC server using https...
.
[Code Snippet]
[Image: 5FwJPYRrS5u-xLl-jBP-lg.png]

[Error]
[Image: JT2Sr1Q.jpg]

Please helpme to use xmlrpc over ssl on codeigniter..
.
Thanks


RE: XMLRPC over https - ciadmin - 04-25-2019

You'll have to paste code inside a code block.

Have you turned debug on to see what is actually being returned?
In your server controller ...

Code:
        $this->load->library('xmlrpc');
        $this->load->library('xmlrpcs');
        $this->xmlrpc->set_debug(TRUE);

and then in your client...

Code:
            $this->xmlrpc->request($request);

            if (!$this->xmlrpc->send_request())
            {
                echo $this->xmlrpc->display_error();
                echo '<br/>' . var_dump($this->xmlrpc->response) . '<br/>';
            }

            $list = $this->xmlrpc->display_response();



RE: XMLRPC over https - finhawkman - 04-26-2019

Thanks for the reply...
.
I have tried debugging and the results as below..
.
Code:
---DATA---
HTTP/1.1 301 Moved Permanently
Date: Fri, 26 Apr 2019 23:54:22 GMT
Connection: close
Cache-Control: max-age=3600
Expires: Sat, 27 Apr 2019 00:54:22 GMT
Location: https://www.mydomain.com/service/xmlrpc_test
Server: cloudflare
CF-RAY: 4cdc7b40b875d1f9-HKG


---END DATA---

Did not receive a '200 OK' response from remote server. (HTTP/1.1 301 Moved Permanently)array(0) { }

Array ( )

I have tried manual debugging and the problem solved by add some code at "system/libraries/Xmlrpc.php" on "sendPayload" function i add and manipulate $server variable use "ssl://" and use port 443 like this
Code:
/**
     * Send payload
     *
     * @param    object    $msg
     * @return    object
     */
    public function sendPayload($msg)
    {
        if ($this->proxy === FALSE)
        {
            $server = $this->server;
            $port = $this->port;
        }
        else
        {
            $server = $this->proxy;
            $port = $this->proxy_port;
        }

               // for ssl request i added this
               // and use port 443
               $server = "ssl://" . $server;
               
        $fp = @fsockopen($server, $port, $this->errno, $this->errstring, $this->timeout);