php


cURL unable to rewind body with APN


I'm trying to send a message to an iOS device using APN, but keep getting this message:
cURL error 0: The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in the same error. Turn on the debug option to see what went wrong. See https://bugs.php.net/bug.php?id=47204 for more information. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
I've tried disabling/enabling https, but doesn't seem to make any difference. The headers look to be exactly the same as their documentation states, but doesn't want to make any difference. Anyone have any ideas?
Here's my code:
$payload = [
"aps" => [
"alert" => "Message received from Bob"
]
];
$client = new Client();
$response = $client->request(
'POST',
'https://api.development.push.apple.com:443',
[
'body' => \GuzzleHttp\json_encode($payload),
'headers' =>
[
'Authorization' => "Bearer: $token",
':method' => 'POST',
':scheme' => 'https',
':path' => "/3/device/$deviceId",
'apns-expiration' => 0,
'apns-priority' => 10
],
'debug' => true,
]
);
Curl version info:
array (size=9)
'version_number' => int 470272
'age' => int 3
'features' => int 573981
'ssl_version_number' => int 0
'version' => string '7.45.0' (length=6)
'host' => string 'x86_64-apple-darwin10.8.0' (length=25)
'ssl_version' => string 'OpenSSL/1.0.1p' (length=14)
'libz_version' => string '1.2.8' (length=5)
'protocols' =>
array (size=20)
0 => string 'dict' (length=4)
1 => string 'file' (length=4)
2 => string 'ftp' (length=3)
3 => string 'ftps' (length=4)
4 => string 'gopher' (length=6)
5 => string 'http' (length=4)
6 => string 'https' (length=5)
7 => string 'imap' (length=4)
8 => string 'imaps' (length=5)
9 => string 'ldap' (length=4)
10 => string 'ldaps' (length=5)
11 => string 'pop3' (length=4)
12 => string 'pop3s' (length=5)
13 => string 'rtsp' (length=4)
14 => string 'smb' (length=3)
15 => string 'smbs' (length=4)
16 => string 'smtp' (length=4)
17 => string 'smtps' (length=5)
18 => string 'telnet' (length=6)
19 => string 'tftp' (length=4)

Related Links

PHP putting “if” in header and “else” in footer
how to fix notice and check file on server side?
How do I export variable columns to a CSV file using PHP?
log4php and timezone
Can i include my session_functions.php in my header then call a function from body.php
PHP add iTXt comment to a PNG image
catch error from a SOAP?
2 drop down menus w/o submit button
$_POST not working
Lookahead assertion as condition in conditional subpattern on .NET regular expression
javascript empty field validation
Autologin with PHP SDK
How to test if Ci successfully inserted data
comparing string against $_GET
Searching mysql database based on completed search
How to get url arguments in array and the url with arguments

Categories

HOME
hpoo
magento2
powerbi
memory
keyboard
bots
softlayer
redmine
postgresql-9.4
foaf
adobe
whmcs
typeerror
malware
google-webmaster-tools
cypher
moodle-api
share
supercollider
documentum
sslhandshakeexception
bnf
gravity
checkout
boomi
infrared
tableview
altium-designer
gollum-wiki
react-dnd
raima
background-color
jackrabbit-oak
annotation-processing
laravel-4.2
amazon-iam
substance
toad
windowsiot
lxml
markov-chains
adminer
grails-2.5
recovery
imgur
minikube
web-inspector
virtual-memory
nomad
xcode8.2
webalizer
image-registration
photoswipe
uiautomatorviewer
beeline
visual-format-language
scala-collections
zend-server
http4s
openerp-6
s-function
cdo.message
codecharge
exists
distributed-cache
wepay
phpquery
http.client
canopy
dynamics-ax-2012-r2
org-babel
explain
wicked-gem
maven-shade-plugin
string.format
vs-unit-testing-framework
configurable-product
rebar
oracle-adf-mobile
webmethod
git-reset
miglayout
sql-function
property-injection
mft
virtual-channel
insertion
background-thread
itunes-sdk
daap
gitx
taskkill
server-name
cakeyframeanimation
trialware
navigationcontroller
multidrop-bus
boost-foreach
play2-mini
3-tier
pinax
getimagesize
external-sorting
database-cloning
efs

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App