1

I am trying to connect to an HTTPS site to post some data. I am using Guzzle 6.3.3. I have read the guzzle documentation http://docs.guzzlephp.org/en/5.3/clients.html?highlight=ssl#ssl-key. I have scowered the internet looking for clues.

class TransmitImmunizationData
{
    public function sendData($idata)
    {

        $client = new Client();

        $identifier = date('Y-m-d') .'-'. rand(999,100001);
        try {
            $r = $client->post('https://edge-ua.org:13000/phr-aphmd', [
                'debug' => true,
                'verify' => true,
                CURLOPT_SSLCERT =>  ['/etc/pki/tls/certs/viis/mape.pem', ''],
                CURLOPT_SSLKEY => '/etc/pki/tls/certs/viis/mape-Key.pem',
                'curl.options' => [
                    'CURLOPT_SSLVERSION' => 'CURL_SSLVERSION_TLSv1_2',
                ],
                'headers' => [
                    'medfx-custom-oid' => '2.16',
                    'medfx-tranaction-id' => $identifier,
                    'medfx-phr-type' => 'IMM',
                ],
                'body' => 'help'
            ]);
        } catch (Exception $e) {
            $p = 'Caught exception: '. $e->getMessage() . "\n";
            return $p;
        }

        return $r->getBody();
    }

}
  • About to connect() to edge-ua.org port 13000 (#0)* Trying 3.23.14.24...* Failed to connect to 3.23.14.24: Permission denied* couldn't connect to host at edge-uat.connectvirginia.org:13000* Closing connection 0

The base coding works. I started here.

class TransmitImmunizationData
{
    public function sendData($idata)
    {
        $client = new Client();
        $identifier = date('Y-m-d') .'-'. rand(999,100001);
        try {
            $r = $client->post('http://httpbin.org/post', [
                'headers' => [
                   'medfx-custom-oid' => '2.16',
                   'medfx-tranaction-id' => $identifier,
                   'medfx-phr-type' => 'IMM',

                ],
                'body' => 'help'
            ]);
        } catch (Exception $e) {
            $p = 'Caught exception: '. $e->getMessage() . "\n";
            return $p;
        }

        return $r->getBody();
    }

}

I get a JSON response back. But when I try to connect to the https site. I just get the error message above. I added the debug hoping it would give me more information but that was a bust. So, I a reaching out across the might internet to see if there is a guru watching that can share with me what is missing.

This was no help

http://docs.guzzlephp.org/en/stable/request-options.html#cert

This was no help either

Moving Curl client ssl to Guzzle

user1794918
  • 1,131
  • 2
  • 16
  • 34

0 Answers0