最近按照客户需求写一个支付异步回调通知url的需求,本想用curl写的,后来想想用file_get_contens是否可以实现,果然可以
$data = array(
'name' => 'anderyly',
'age' => '19',
'grade' => 'boy',
);
$query = http_build_query($data);
$options['http'] = array(
'timeout' => 60,
'method' => 'POST',
'header' => 'Content-type:application/x-www-form-urlencoded',
'content' => $query
);
$url = "https://blog.aaayun/cc/";
$context = stream_context_create($options);
$result = @file_get_contents($url, false, $context);
评论 (0)