简体   繁体   中英

How can i get html headers with phpunit using Selenium2?

public function testheaders()
{
         $url=$this->url('http://www.example.com/index.php');
         $kur = get_headers($url);
         var_dump($kur);
}

I got the error : get_headers(): Filename cannot be empty .

My class extends PHPUnit_Extensions_Selenium2TestCase like my all my other tests.

get_headers() is a PHP function that will give you the headers return by an HTTP request to a specified url. The parameter you need to give is a string, but $this->url() return an PHPUnit_Selenium-object.

If you want the headers of that known URL, why not do directly?

$kur = get_headers('http://www.example.com/index.php');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM