mirror of
https://github.com/php/php-src.git
synced 2024-10-03 07:46:12 +00:00
35 lines
891 B
PHP
35 lines
891 B
PHP
--TEST--
|
|
Test curl_copy_handle() with User Agent
|
|
--CREDITS--
|
|
Rick Buitenman <rick@meritos.nl>
|
|
#testfest Utrecht 2009
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
|
|
|
echo '*** Testing curl copy handle with User Agent ***' . "\n";
|
|
|
|
$url = "{$host}/get.php?test=useragent";
|
|
$ch = curl_init();
|
|
|
|
ob_start(); // start output buffering
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($ch, CURLOPT_USERAGENT, 'cURL phpt');
|
|
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
|
|
|
|
$copy = curl_copy_handle($ch);
|
|
curl_close($ch);
|
|
|
|
$curl_content = curl_exec($copy);
|
|
curl_close($copy);
|
|
|
|
var_dump( $curl_content );
|
|
?>
|
|
===DONE===
|
|
--EXPECTF--
|
|
*** Testing curl copy handle with User Agent ***
|
|
string(9) "cURL phpt"
|
|
===DONE===
|