Se supone que funcione correctamente como lo estás indicando. Pero para que tengas una mejor idea de lo que puedes hacer:
a.php
Código PHP:
Ver original<?php
curl_setopt($ch, CURLOPT_URL
, 'http://localhost/b.php'); curl_setopt($ch, CURLOPT_POSTFIELDS
, 'foo=bar&baz=candy');
echo '<pre>';
echo '</pre>';
curl_setopt($ch, CURLOPT_URL
, 'http://localhost/c.php');
echo '<pre>';
echo '</pre>';
curl_setopt($ch, CURLOPT_URL
, 'http://localhost/c.php'); curl_setopt($ch, CURLOPT_COOKIE
, 'foo=vegetable; baz=fuits');
echo '<pre>';
echo '</pre>';
b.php c.php Resultado
Código HTML:
Ver originalstring(13) "array(0) {
}
"
string(75) "array(2) {
["baz"]=>
string(5) "candy"
["foo"]=>
string(3) "bar"
}
"
string(81) "array(2) {
["foo"]=>
string(9) "vegetable"
["baz"]=>
string(5) "fuits"
}
"
Resultado en cookie.txt
Código txt:
Ver original# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
localhost FALSE / FALSE 0 foo bar
localhost FALSE / FALSE 0 baz candy
Si te fijas, puedes enviar directamente las cookies con
CURLOPT_COOKIE. En el área de aportes hay un tema que da más ejemplos.