欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php curl模擬post請(qǐng)求小實(shí)例

 更新時(shí)間:2013年11月13日 11:29:17   作者:  
使用php curl模擬post請(qǐng)求的小例子,提供大家學(xué)習(xí)一下
本機(jī):
復(fù)制代碼 代碼如下:

<?php
$uri = "http://www.a.com/test.php";//這里換成你服務(wù)器的地址
// 參數(shù)數(shù)組
$data = array (
  'name' => 'tanteng'
// 'password' => 'password'
);

$ch = curl_init ();
// print_r($ch);
curl_setopt ( $ch, CURLOPT_URL, $uri );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
$return = curl_exec ( $ch );
curl_close ( $ch );

print_r($return);

遠(yuǎn)程服務(wù)器:
復(fù)制代碼 代碼如下:

<?php
if(isset($_POST['name'])){
 if(!empty($_POST['name'])){
  echo '您好,',$_POST['name'].'!';
 }
}

相關(guān)文章

最新評(píng)論