Re: Error occurred when post data via PHP7 with cURL by HTTP/2
Allen Tsao <[email protected]> Mon, 18 Apr 2016 23:49:39 +0000
| Newsgroups | gmane.comp.web.curl.php |
|---|---|
| Message-ID | <CAN31VeV0nimnwz8SO0NuZfDq8ic6pX+ioao1NWF6JkJNhpPzXg@mail.gmail.com> |
--===============0175401609==
Content-Type: multipart/alternative; boundary=001a113ef4528f193e0530cb032b
--001a113ef4528f193e0530cb032b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Thank you for your help.
The error message is coming from when curl_exec($ch) executed in PHP7. The
full message is "=18=04=01=10=03=01=EF=BF=BD=05@=06=1F@=EF=BF=BD=07=01HTTP/=
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 <[email protected]> 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 othe=
r
> 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 nat=
ure
>> 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 redha=
t7,
>> 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
>
--001a113ef4528f193e0530cb032b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Thank you for your help.<div><br></div><div>The error mess=
age is coming from when curl_exec($ch) executed in PHP7. The full message i=
s "<span style=3D"color:rgb(0,0,0);font-family:monospace;font-size:med=
ium;white-space:pre-wrap">=18=04=01=10=03=01=EF=BF=BD=05@=06=1F@=EF=BF=BD=
=07=01HTTP/2 client preface string missing or corrupt. Hex dump for receive=
d bytes: 504f5354202f332f6465766963652f383566303235373164</span>".=C2=
=A0</div><div><br></div><div>This happened when I post to Apple APNs:=C2=A0=
<a href=3D"https://api.development.push.apple.com/">https://api.development=
.push.apple.com/</a>. It's ok if I access <a href=3D"https://nghttp2.or=
g">https://nghttp2.org</a>. But it's strange that I can use curl comman=
d to access Apple APNs successfully as listed below.</div><div><br></div><d=
iv><span style=3D"color:rgb(34,36,38);font-family:Arial,'Helvetica Neue=
',Helvetica,sans-serif;font-size:15px;line-height:19.5px">curl -d '=
{"aps":{"alert":"test message","sound&qu=
ot;:"default"}}' --cert /xxx/xxx.pem:xxxx -H "apns-topic=
:chs.itsme" --http2</span><a href=3D"https://api.development.push.appl=
e.com/3/device/85f0257xxxxx" rel=3D"nofollow" style=3D"margin:0px;padding:0=
px;border:0px;font-size:15px;color:rgb(0,89,153);text-decoration:none;font-=
family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5=
px">https://api.development.push.apple.com/3/device/85f0257xxxxx</a><br></d=
iv><div><br></div><div>On my server, I installed openssl by YUM at first ti=
me, and the rebuild the latest version from source. Now if I use the comman=
d to check OpenSSL version on Redhat 7 I can see the version is "<span=
style=3D"color:rgb(34,36,38);font-family:Arial,'Helvetica Neue',He=
lvetica,sans-serif;font-size:15px;line-height:19.5px">OpenSSL 1.0.2g 1 Mar =
2016</span>". 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 se=
arched 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=
.</div><div><br></div><div>Thank you very much for your help.</div>
<div><br></div><div><br></div></div><div class=3D"gmail_extra"><br><div cla=
ss=3D"gmail_quote">On Mon, Apr 18, 2016 at 10:04 PM, Daniel Stenberg <span =
dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_blank">daniel@=
haxx.se</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D=
"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=
=3D"">On Mon, 18 Apr 2016, Allen Tsao wrote:<br>
<br>
</span><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-=
left:1px #ccc solid;padding-left:1ex"><span class=3D"">
Hi all,<br>
<br>
I got error message when I send push message to APNs via PHP7+cURL.<br>
<br></span>
error message: ???@@???HTTP/2 client preface string missing or corrupt. Hex=
dump for received bytes:<br>
</blockquote>
<br>
Where does that message come from? What does it mean?<br>
<br>
I assume this means you're talking to a HTTPS server? Have you tried ot=
her HTTP/2 speaking servers?<span class=3D""><br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
I guess it's because of PHP7 but not very sure. with phpinfo() I can se=
e that no mod_ssl loaded but from Internet it says PHP7 support ssl by natu=
re so openssl.so is not existed in system any more. Also it's strange w=
ith phpinfo() I saw the openssl version is 1.0.1e which is coming with redh=
at7, not the one I installed from source.<br>
</blockquote>
<br></span>
I don't understand. Did your PHP/CURL use OpenSSL 1.0.1 or 1.0.2 ?<span=
class=3D"HOEnZb"><font color=3D"#888888"><br>
<br>
-- <br>
<br>
=C2=A0/ <a href=3D"http://daniel.haxx.se" rel=3D"noreferrer" target=3D"_bla=
nk">daniel.haxx.se</a><br>
_______________________________________________<br>
<a href=3D"http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php" rel=
=3D"noreferrer" target=3D"_blank">http://cool.haxx.se/cgi-bin/mailman/listi=
nfo/curl-and-php</a><br>
</font></span></blockquote></div><br></div>
--001a113ef4528f193e0530cb032b--
--===============0175401609==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KaHR0cDovL2Nv
b2wuaGF4eC5zZS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vY3VybC1hbmQtcGhwCg==
--===============0175401609==--