1--TEST-- 2Test curl_opt() function with COOKIE 3--CREDITS-- 4TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com> 5--SKIPIF-- 6<?php include 'skipif.inc'; ?> 7--FILE-- 8<?php 9/* Prototype : bool curl_setopt(resource ch, int option, mixed value) 10 * Description: Set an option for a cURL transfer 11 * Source code: ext/curl/interface.c 12 * Alias to functions: 13 */ 14 15 include 'server.inc'; 16 $host = curl_cli_server_start(); 17 18 // start testing 19 echo '*** Testing curl with cookie ***' . "\n"; 20 21 $url = "{$host}/get.php?test=cookie"; 22 $ch = curl_init(); 23 24 ob_start(); // start output buffering 25 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 26 curl_setopt($ch, CURLOPT_COOKIE, 'foo=bar'); 27 curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use 28 29 $curl_content = curl_exec($ch); 30 curl_close($ch); 31 32 var_dump( $curl_content ); 33?> 34===DONE=== 35--EXPECTF-- 36*** Testing curl with cookie *** 37string(3) "bar" 38===DONE=== 39 40