用file_get_contents函數(shù),以post方式獲取url示例

2022-06-10    分類: 網(wǎng)站建設(shè)

用file_get_contents函數(shù),以post方式獲取url的示例

$data=array('foo'=>'bar');
$data=http_build_query($data);

  $opts=array(
    'http'=>array(
   'method'=>'POST',
   'header'=>"Content-type: application/x-www-form-urlencoded\r\n".
    "Content-Length: ".strlen($data)."\r\n",
'content'=>$data
),
);
$context=stream_context_create($opts);
$html=file_get_contents('http://localhost/e/admin/test.html',false,$context);
echo$html;
?>

網(wǎng)站題目:用file_get_contents函數(shù),以post方式獲取url示例
文章位置:http://muchs.cn/news/165959.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航、網(wǎng)站設(shè)計(jì)公司微信小程序、ChatGPT、電子商務(wù)網(wǎng)站排名

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁設(shè)計(jì)公司