您的位置:首页 > 其它

file_get_contents($url) stream_get_contents($stream)

2016-04-06 09:06 295 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

 <head>

  <title> get_contents.php </title>

  <meta charset="UTF-8">

  <meta name="Author" content="">

  <meta name="Keywords" content="">

  <meta name="Description" content="">

 </head>

 <body>

<hr>

<?php

$url='http://localhost/myphp/StrPrice.html';

$contents=file_get_contents($url) or die('file_get_contents failed!');

var_dump($contents);

$stream=fopen($url,'rb');

$contents=stream_get_contents($stream) or die('stream_get_contents failed!');

var_dump($contents);

fclose($stream);

$ch = curl_init();

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_URL,$url);

$result = curl_exec($ch);

var_dump($result);

?>

<br><br>

 </body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: