|
查看: 1254|回复: 14
|
[PHP] 请问有谁明白吗?
[复制链接]
|
|
|
Program a function in PHP that sends a HTTP-GET-request.
Analyze the response-code you get and display a proper message.
If the url exists, download the file and parse it for its content-type and all other information you can get from the header. |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 16-7-2007 10:11 AM
|
显示全部楼层
需要用到PECL? |
|
|
|
|
|
|
|
|
|
|
发表于 16-7-2007 12:16 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 16-7-2007 02:21 PM
|
显示全部楼层
原帖由 thkee 于 16-7-2007 12:16 PM 发表 
PECL 让你不用WRITE 你的一些FUNCTION。
http://pecl.php.net/packages.php
download了php_http.dll。
搬去我.dll的folder。
在php.ini加了extension php_http.dll。
restart我的services。
但是Call to undefined function http_get()
 |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 16-7-2007 03:25 PM
|
显示全部楼层
是不是我少了什么步骤? |
|
|
|
|
|
|
|
|
|
|
发表于 16-7-2007 03:39 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 16-7-2007 03:42 PM
|
显示全部楼层
Introduction to PECL Installations
Downloading PECL extensions
PECL for Windows users
Compiling shared PECL extensions with the pecl command
Compiling shared PECL extensions with phpize
Compiling PECL extensions statically into PHP
http://www.php.net/manual/en/install.pecl.php |
|
|
|
|
|
|
|
|
|
|
发表于 16-7-2007 06:25 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 16-7-2007 07:19 PM
|
显示全部楼层
原帖由 vampcheah 于 16-7-2007 06:25 PM 发表 
呵呵 我路过的,
什么是PECL ? 什么用处V
http://pecl.php.net/
[ 本帖最后由 hui_wooi 于 16-7-2007 07:22 PM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
发表于 26-7-2008 12:10 PM
|
显示全部楼层
LZ!原来这你也跑过来啦!  |
|
|
|
|
|
|
|
|
|
|
发表于 26-7-2008 02:22 PM
|
显示全部楼层
原帖由 hui_wooi 于 16-7-2007 01:02 AM 发表 
Program a function in PHP that sends a HTTP-GET-request.
Analyze the response-code you get and display a proper message.
If the url exists, download the file and parse it for its content-type and al ...
fopen 就可以了。 |
|
|
|
|
|
|
|
|
|
|
发表于 27-7-2008 08:46 PM
|
显示全部楼层
原帖由 hui_wooi 于 16-7-2007 10:11 AM 发表 需要用到PECL? 不用啦。- <?php
- $buf = <<< EXCERPT
- <html><head><title>HTTP Request</title></head>
- <body>
- <form id="request" method="post" target="#">
- <p>url
- <input id="url" name="url" type="text"/>
- <input type="submit" name="Submit">
- </form>
- </body>
- </html>
- EXCERPT;
- print $buf;
- if ($url = $_POST['url']) {
- printf("<pre><a href="%s">%s</a></pre>", $url, $url);
- httpRequest($url);
- }
- function httpRequest($url) {
- define ('KB', 1024);
- if ($r = fopen($url, 'r')) {
- print '<p>request headers information:<pre>';
- print var_dump(get_headers($url, 1)).'</pre>';
- while ($buf = fread($r, 1 * KB)) {
- // do whatever...
- }
- }
- }?>
复制代码
[ 本帖最后由 黄sir 于 27-7-2008 09:00 PM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
发表于 31-7-2008 12:28 AM
|
显示全部楼层
<?php
$buf = <<< EXCERPT
<html><head><title>HTTP Request</title></head>
<body>
<form id="request" method="post" target="#">
<p>url
<input id="url" name="url" type="text"/>
<input type="submit" name="Submit">
</form>
</body>
</html>
EXCERPT;
print $buf;
if ($url = $_POST['url']) {
printf("<pre><a href=\"%s\">%s</a></pre>", $url, $url);
httpRequest($url);
}
function httpRequest($url) {
define ('KB', 1024);
if ($r = fopen($url, 'r')) {
print '<p>request headers information:<pre>';
print var_dump(get_headers($url, 1)).'</pre>';
while ($buf = fread($r, 1 * KB)) {
// do whatever...
}
}
}?>
想请教一下,红色的是用来做什么的?
[ 本帖最后由 Sui_G_G 于 31-7-2008 12:29 AM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
发表于 31-7-2008 11:59 PM
|
显示全部楼层
原帖由 Sui_G_G 于 31-7-2008 12:28 AM 发表 
想请教一下,红色的是用来做什么的?
去  php.net 打  echo
你就知道是什么了 |
|
|
|
|
|
|
|
|
|
|
发表于 1-8-2008 12:44 PM
|
显示全部楼层
回复 14# cupid25 的帖子
|
谢谢。原来是heredoc。现在才懂有这样的东西。 |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|