CURL context options — CURL 上下文选项列表
CURL 上下文选项在 CURL 扩展被编译(通过 --with-curlwrappers configure选项)时可用
Example #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);
?>