php 通过 file_get_contents 模拟发送 get 请求

PHP
4 行
<?php
$url='http://www.phpernote.com/php-function/654.html';
$re=file_get_contents($url);
print_r($re);

php 通过 curl 模拟发送 get 请求

PHP
8 行
<?php
$ch=curl_init('http://www.phpernote.com/php-function/651.html');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_BINARYTRANSFER,true);
$output=curl_exec($ch);
$fh=fopen("out.html",'w');
fwrite($fh,$output);
fclose($fh);

php 通过 fsocket 模拟发送 get 请求

该函数的使用方法如下:

Bash
3 行
$url='http://www.phpernote.com/jquery-effects/650.html?page=2';
echo "以下是GET方式的响应内容:<br>";
sock_get($url);