xref: /PHP-8.2/ext/curl/tests/curl_basic_005.phpt (revision 8567bc10)
1--TEST--
2Test curl_opt() function with user agent
3--CREDITS--
4Sebastian Deutsch <sebastian.deutsch@9elements.com>
5TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
6--EXTENSIONS--
7curl
8--FILE--
9<?php
10  include 'server.inc';
11  $host = curl_cli_server_start();
12
13  // start testing
14  echo '*** Testing curl with user agent ***' . "\n";
15
16  $url = "{$host}/get.inc?test=useragent";
17  $ch = curl_init();
18
19  ob_start(); // start output buffering
20  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
21  curl_setopt($ch, CURLOPT_USERAGENT, 'cURL phpt');
22  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
23
24  $curl_content = curl_exec($ch);
25  curl_close($ch);
26
27  var_dump( $curl_content );
28?>
29--EXPECT--
30*** Testing curl with user agent ***
31string(9) "cURL phpt"
32