0
Я работаю на стороне сервера в php. Первоначально тестирование этого кода:Curl give Result Fail
$apiKey = "";
$registrationIDs = array("");
$message = "hello";
$url = 'https://android.googleapis.com/gcm/send';
$fields = array(
'registration_ids' => $registrationIDs,
'data' => array("message" => $message),
);
$headers = array(
'Authorization: key=' . $apiKey,
'Content-Type: application/json'
);
$ch = curl_init();
$u=curl_setopt($ch, CURLOPT_URL, $url);
$p=curl_setopt($ch, CURLOPT_POST, true);
$f=curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$h=curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$t=curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$c=curl_setopt($ch, CURLOPT_VERBOSE, true);
$j=curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
$responseInfo = curl_getinfo($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$responseHeader = substr($result , 0, $header_size);
$responseBody = substr($result , $header_size);
echo 'Header: <br>'. $responseHeader;
echo 'Body: <br>'. $responseBody;
curl_close($ch);
var_dump($ch);
var_dump($result);
but on :
var_dump($ch);
var_dump($result);
браузер отдавание:
Заголовок: тело: ресурс (2) типа (Unknown)
BOOL (ложного)
любого help
Благодарности @Venu :) –
благодарит Джей Hardia Ваше предложение работы – User42590