I need to know how to convert the code below to .php code (which I’m not good with)
the code:
curl -X POST -u "<application key>:<master secret>" \
-H "Content-Type: application/json" \
--data '{"device_tokens": ["<token>"], "aps": {"alert": "Hello!"}}' \
https://go.xxx.com/api/push/
EDIT: I TRIED this:
<?
$msg = "hello from bob";
$token = "72F75474E3360C4C2F26C6AB16FC1E638FE55FCAC92EE4EB4C196123XXXXXXXX";
exec('curl -X POST -u "_rEUqtOtSmSVEBd8uMfdtg:vpB2wmR8Q_2HZ_Jmi37t-Q" \
-H "Content-Type: application/json" \
--data \'{"aps": {"alert": "'.$msg.'", "sound": "default"}, "device_tokens": ["'.$token.'"]}\' \
https://go.xxx.com/api/push/
');
?>
You can try using PHP’s cURL functions to accomplish this. The following should achieve what you want (untested):