CURL context options

CURL context option listing

CURL context options are available when the CURL extension was compiled using the --with-curlwrappers configure option.

Examples:
Fetch a page and send POST data
<?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);

?>

See also:

Socket context options -

doc_php
2016-02-24 15:53:20
Comments
Leave a Comment

Please login to continue.