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

php程序內(nèi)部post數(shù)據(jù)的方法

 更新時(shí)間:2015年03月31日 10:11:25   作者:songguo  
這篇文章主要介紹了php程序內(nèi)部post數(shù)據(jù)的方法,涉及curl的使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了php程序內(nèi)部post數(shù)據(jù)的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

$postData = array();
$postData['data1'] = "testdata1";
$postData['data2'] = "testdata2";
$postData['data3'] = "testdata3";
$url='http://yourdomain/do.php';
$str="";
foreach ($postData as $k=>$v)
{
  $str.= "$k=".urlencode($v)."&";
}
$postData=substr($str,0,-1);
$c = curl_init();
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_URL,$url);
curl_setopt($c, CURLOPT_POSTFIELDS, $postData);
$result = curl_exec($c);

希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論