cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Error occurred when post data via PHP7 with cURL by HTTP/2

From: Allen Tsao <ostrich.tsao_at_gmail.com>
Date: Mon, 18 Apr 2016 23:49:39 +0000

Thank you for your help.

The error message is coming from when curl_exec($ch) executed in PHP7. The
full message is "�@@�HTTP/2 client preface string missing or
corrupt. Hex dump for received bytes:
504f5354202f332f6465766963652f383566303235373164".

This happened when I post to Apple APNs:
https://api.development.push.apple.com/. It's ok if I access
https://nghttp2.org. But it's strange that I can use curl command to access
Apple APNs successfully as listed below.

curl -d '{"aps":{"alert":"test message","sound":"default"}}' --cert
/xxx/xxx.pem:xxxx -H "apns-topic:chs.itsme" --http2
https://api.development.push.apple.com/3/device/85f0257xxxxx

On my server, I installed openssl by YUM at first time, and the rebuild the
latest version from source. Now if I use the command to check OpenSSL
version on Redhat 7 I can see the version is "OpenSSL 1.0.2g 1 Mar 2016".
However, when I run "php -i" I saw the OpenSSL version is OpenSSL 1.0.1e
which is the version installed by YUM. I have searched my linux with "find
/ -name openssl" and there is only one file found. No idea why PHP is still
using the old version and where is it.

Thank you very much for your help.

On Mon, Apr 18, 2016 at 10:04 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Mon, 18 Apr 2016, Allen Tsao wrote:
>
> Hi all,
>>
>> I got error message when I send push message to APNs via PHP7+cURL.
>>
>> error message: ???@@???HTTP/2 client preface string missing or corrupt.
>> Hex dump for received bytes:
>>
>
> Where does that message come from? What does it mean?
>
> I assume this means you're talking to a HTTPS server? Have you tried other
> HTTP/2 speaking servers?
>
> I guess it's because of PHP7 but not very sure. with phpinfo() I can see
>> that no mod_ssl loaded but from Internet it says PHP7 support ssl by nature
>> so openssl.so is not existed in system any more. Also it's strange with
>> phpinfo() I saw the openssl version is 1.0.1e which is coming with redhat7,
>> not the one I installed from source.
>>
>
> I don't understand. Did your PHP/CURL use OpenSSL 1.0.1 or 1.0.2 ?
>
> --
>
> / daniel.haxx.se
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2016-04-19