$headers = array(
"TYPE:xxxxooooo",
"TOKEN:00000000"
);
$data = array(
'data' => array('name' => 'test','AGE'=>22),
'registration_ids' => array('APA91bEyno5XgFPvIGxMezCsnaOXwmxbHXzxAJ6X_v2w0VPEFrUb24Mw9LdeTqpA6kHkaxrwHD8N_QsBpRduKll3K9qEe2EYIw1y_rqW9UNsU_X4NsnanTVjscPBBkWVkIOfDqff6QlQJOmvA1x2kAkloq0bgMHmDe_HoWKjh1IhoDHgJzw5L2c')
);
$url = "http://www.adtuu-server.com/curl-get.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST,count($data)) ;
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
// curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
$input = file_get_contents('php://input');
$input = json_decode($input, true);
var_dump($input);
var_dump($_SERVER);
var_dump($_SERVER['HTTP_TYPE']);
var_dump($_SERVER['HTTP_TOKEN']);CURL的使用<发送与接收数据>
阅读132评论02018-11-14 14:16:26

fffffasdfasdfasdfasdfas;kdfjlaskl;dfjaskl;dfjakls;dfjkal;sfdjlaks;df als;dfj awkls;dfj asl;dfj aslk;dfjaskl;dfjas;ldf
访客评论