Ich habe Fehlermeldung, wenn ich Push-Nachricht an APNs über PHP7 + cURL senden.PHP7, HTTP2 mit cURL
Fehlermeldung:
�@@�HTTP/2 client preface string missing or corrupt. Hex dump for received bytes:
Ich denke, es wegen PHP7 ist aber nicht ganz sicher. mit phpinfo() kann ich sehen, dass keine mod_ssl geladen, aber aus dem Internet sagt PHP7 Unterstützung ssl von Natur aus so openssl.so ist nicht mehr im System vorhanden. Auch ist es seltsam mit phpinfo() Ich sah die openssl-Version ist 1.0.1e, die mit redhat7 kommt, nicht die, die ich von der Quelle installiert habe.
Ich installierte php7 von yum, und der Rest, OpenSSL, nghttp, rotation von der Quelle installiert.
Php Code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, 3);
//curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $alert);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("apns-topic: $apns_topic"));
curl_setopt($ch, CURLOPT_SSLCERT, $pemfile);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $pempwd);
$response = curl_exec($ch);
Der Server ist REDHAT 7. Umwelt Info wie folgt zu finden ist.
$ openssl version
OpenSSL 1.0.2g 1 Mar 2016
curl --version
curl 7.48.0 (x86_64-pc-linux-gnu) libcurl/7.48.0 OpenSSL/1.0.2g nghttp2/1.9.2
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL TLS-SRP HTTP2 UnixSockets
$ php --version
PHP 7.0.5 (cli) (built: Apr 2 2016 13:08:13) (NTS)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
$ curl --http2 -I https://nghttp2.org
HTTP/2.0 200
date:Sun, 17 Apr 2016 13:15:27 GMT
content-type:text/html
last-modified:Sat, 16 Apr 2016 14:56:04 GMT
etag:"57125284-1a0a"
accept-ranges:bytes
content-length:6666
x-backend-header-rtt:0.001459
strict-transport-security:max-age=31536000
server:nghttpx nghttp2/1.10.0-DEV
via:2 nghttpx
x-frame-options:SAMEORIGIN
x-xss-protection:1; mode=block
x-content-type-options:nosniff
Auch kann ich Befehlszeile verwenden Push-Nachricht auf mein Handy senden:
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
http://stackoverflow.com/questions/34684099/new-apns-provider-api-and-php/34831873#34831873 –
Vielen Dank. Ich habe diesen Beitrag gesehen, aber mein Problem nicht gelöst. –
Einen neuen Link veröffentlicht, bitte sehen Sie es sich an. –