xref: /PHP-8.0/ext/curl/tests/curl_basic_004.phpt (revision b5c7a83d)
1--TEST--
2Test curl_opt() function with setting referer
3--CREDITS--
4Sebastian Deutsch <sebastian.deutsch@9elements.com>
5TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
6--SKIPIF--
7<?php include 'skipif.inc'; ?>
8--FILE--
9<?php
10  include 'server.inc';
11  $host = curl_cli_server_start();
12
13  // start testing
14  echo '*** Testing curl setting referer ***' . "\n";
15
16  $url = "{$host}/get.inc?test=referer";
17  $ch = curl_init();
18
19  ob_start(); // start output buffering
20  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
21  curl_setopt($ch, CURLOPT_REFERER, 'http://www.refer.er');
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 setting referer ***
31string(19) "http://www.refer.er"
32