curl方式post
$postData = array(
'action' => 'req',
'type' => 'post'
);
$handle = curl_init();
$url = 'http://127.0.0.1/reg.php';
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_POST, 1);
curl_setopt($handle, CURLOPT_POSTFIELDS, $postData);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);//返回数据为字符串
$response = curl_exec($handle);
curl_close($handle);
echo $response;exit;