CURL 上下文選項
CURL 上下文選項 — CURL 上下文選項列表
說明
CURL 上下文選項在 CURL 擴充套件被編譯(通過 --with-curlwrappers configure選項)時可用
範例
示例 #1 獲取一個頁面,並以POST發送數據
<?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);
?>