php中几个文件读取函数的贴心功能
2009-08-31 17:07
399 查看
<?php
$html = file_get_contents('http://www.example.com/');
print_r($http_response_header);
// or
$fp = fopen('http://www.example.com/', 'r');
print_r(stream_get_meta_data($fp));
fclose($fp);
?>
示例代码2:
<?php
$data = array ('foo' => 'bar');
$data = http_build_query($data);
$opts = array (
'http' => array (
'method' => 'POST',
'header'=> "Content-type: application/x-www-form-urlencoded\r\n" .
"Content-Length: " . strlen($data) . "\r\n",
'content' => $data
),
);
$context = stream_context_create($opts);
$html = file_get_contents('http://www.example.com', false, $context);
echo $html;
?>
from:http://www.ugia.cn/?p=140
$html = file_get_contents('http://www.example.com/');
print_r($http_response_header);
// or
$fp = fopen('http://www.example.com/', 'r');
print_r(stream_get_meta_data($fp));
fclose($fp);
?>
示例代码2:
<?php
$data = array ('foo' => 'bar');
$data = http_build_query($data);
$opts = array (
'http' => array (
'method' => 'POST',
'header'=> "Content-type: application/x-www-form-urlencoded\r\n" .
"Content-Length: " . strlen($data) . "\r\n",
'content' => $data
),
);
$context = stream_context_create($opts);
$html = file_get_contents('http://www.example.com', false, $context);
echo $html;
?>
from:http://www.ugia.cn/?p=140
相关文章推荐
- 几个PHP读取整个文件的函数readfile()、fpassthru()和file()
- 几个PHP读取整个文件的函数readfile()、fpassthru()和file()
- PHP中读取文件的几个方法
- php读取外部txt文件内容并打印在页面|fopen()函数
- 利用php内置的svn函数实现的根据svn版本号导出相关文件的功能
- PHP各种引入(读取)文件函数的执行效率include require fpassthru readfile等的性能比较
- 几个非常有用的函数-获取可执行文件所在的目录及读取配置文件
- php读取目录文件函数is_dir(),opendir(),readdir(),closedir()
- PHP 文件读取 fread、fgets、fgetc、file_get_contents 与 file 函数
- PHP的几个配置文件函数
- PHP文件读取功能的应用实例
- php的几个配置文件函数
- PHP 的几个配置文件函数
- PHP中读取文件的几个方法
- PHP获取和操作配置文件php.ini的几个函数介绍
- php读取csv实现csv文件下载功能
- 文件的读取中几个函数的使用
- php读取本地文件常用函数(fopen与file_get_contents)
- PHP获取和操作配置文件php.ini的几个函数
- php实现的读取CSV文件函数示例