CURL 上下文選項 — CURL 上下文選項列表
CURL 上下文選項在 CURL 擴(kuò)展被編譯(通過 --with-curlwrappers configure選項)時可用
示例 #1 獲取一個頁面,并以POST發(fā)送數(shù)據(jù)
<?php
$postdata = http_build_query(
array(
'var1' => 'some content',
'var2' => 'doh'
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents('http://example.com/submit.php', false, $context);
?>