コード例 #1
0
 /**
  * A basic test example.
  *
  * @return void
  */
 public function testExample()
 {
     $ref = "http://www.koshkimira.ru/";
     $reference = new Reference();
     $charset = "utf-8";
     // try{
     $context = stream_context_create(array("http" => array("method" => "GET", "header" => "Accept: xml/*, text/*, */*\r\n", 'user_agent' => "Mozilla/3.0\r\nAccept: */*\r\nX-Padding: Foo", "ignore_errors" => true, "timeout" => 50)));
     $content = file_get_contents($ref, false, $context);
     // 	   if ( $headers['response_code'] != 200 )
     // 	   {
     // 	   		return "Warning ERROR: Can not fetch HTML from ".$ref."\n Response Code is ".$headers['response_code'];
     // 	   }
     // 	}
     // catch (\Exception $e)
     // 	{
     // 	    $mes = $e->getMessage();
     // 	    return "Warning ERROR: Can not fetch HTML from ".$ref."\n".$mes;
     // 	}
     $encoded = $reference->setEncoding($content);
     $this->assertEquals($content, $encoded);
 }