set up rest with https |
I have set up REST server support https using my own generated certificate.
Then I have the client POSTing data using https. But it seems not work. When using http it works. Here the code PHP Code: case "POST": // Used to create a new object on the server (INSERT) I'm sure config_item('cert_path') points to certificate file downloaded from server Tell me if I'm wrong setting up curl. Also, how to know if my clients certificate rejected by server? Is CI reports it in log (server) or log (client)?
make a var_dump on $rdata for error messages.
cert_path should be a local path to a .pem file.
i do log_message('debug', var_export($rdata, TRUE));
The result is 'false' No messages
Ok, you got an error then.
Use curl_error to see what: http://php.net/manual/en/function.curl-e...r-examples
OK, done. Thanks..
So is use curl_error($ch) to see. I'm using CI4, so i set cert path in .env : app.CertPath = APPPATH.'Cert/livehost.crt' and in the code : curl_setopt($ch, CURLOPT_CAINFO, $config->CertPath); But unfortunately APPPATH not work on .env, curl error says "error setting certificate verify locations" and show plain APPPATH !! It should be changed with 'something/application' So I change on .env : app.CertPath = 'application/Cert/livehost.crt' and in the code : curl_setopt($ch, CURLOPT_CAINFO, ROOTPATH.$config->CertPath);
I haven't tried CI4, so can't give you any feedback on why that's not working. But at least you can hardcode it for now.
|
Welcome Guest, Not a member yet? Register Sign In |