xref: /PHP-8.2/ext/curl/tests/curl_basic_011.phpt (revision 8567bc10)
1--TEST--
2Test curl_opt() function with COOKIE
3--CREDITS--
4TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
5--EXTENSIONS--
6curl
7--FILE--
8<?php
9  include 'server.inc';
10  $host = curl_cli_server_start();
11
12  // start testing
13  echo '*** Testing curl with cookie ***' . "\n";
14
15  $url = "{$host}/get.inc?test=cookie";
16  $ch = curl_init();
17
18  ob_start(); // start output buffering
19  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
20  curl_setopt($ch, CURLOPT_COOKIE, 'foo=bar');
21  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
22
23  $curl_content = curl_exec($ch);
24  curl_close($ch);
25
26  var_dump( $curl_content );
27?>
28--EXPECT--
29*** Testing curl with cookie ***
30string(3) "bar"
31