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>
<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>
相关文章推荐
- 触摸反馈(波纹效果Ripple)
- Kafka教程
- JAVA中使用FTPClient实现文件上传下载
- Android属性动画,android属性
- Android之Intent
- vs2013外接程序”VMDebugger”加载异常处理
- commons-lang(一)
- Android Environment 常量含义
- 初识HTML
- Apache kafka 工作原理介绍
- Kafka使用入门教程
- PHP常用到的功能函数
- 现代操作系统第三版课后习题解答
- SQL Server 2012 安全概述
- SVN使用教程总结
- 欢迎使用CSDN-markdown编辑器
- 猜字游戏---批处理
- 基数排序
- 【Unity】4.2 提升开发效率的捷径--导入 Unity 5.3.4 自带的资源包
- jls之happen-before