In PHP 5.2.6, the header option requires an array and not a string if PHP is built with --with-curlwrappers
Patrick Allaert
http://patrickallaert.blogspot.com/
EDIT: In PHP 5.2.10 both string or an array are accepted. // Jani
Opciones de contexto para CURL
Opciones de contexto para CURL — Listado de opciones de contexto para CURL
Descripción
Las opciones de contexto para CURL están disponibles cuando la extensión CURL fue compilada usando la opción de configuración --with-curlwrappers .
Ejemplos
Ejemplo #1 Obtener una página y enviar datos 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);
?>
patrick dot allaert at gmail dot com ¶
4 years ago
