使用Php获取网页内容 [英] getting a webpage content using Php
本文介绍了使用Php获取网页内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在我知道这样做比较简单,但是我想使用表单来获取要在其中使用的URL。
Now this I know is relatively simple to do, but i want to use a form to get the URLs to use in this. I started using file_get_contents but then i switched to fopen.
<?php
$marki = fopen($page, "rb");
$page = $_GET['page'];
echo $marki;
?>
<html>
<body>
<form method="get" action="index.php">
<input type="text" name="page">
<input type="submit" value="grade">
</form>
</body>
</html>
这是我迄今使用的代码,我认为它的答案仍然可能在于使用file_get_contents但它不会得到页面内容,因为它一直将获取的内容指向存储在我的服务器中的文件,这不是我想要的。
this is the code i have used so far, I think it the answer could still lie with using file_get_contents but it wont get the page contents as it keeps pointing the get contents to files stored in my server which is not what I am aiming for.
推荐答案
在 $ marki
之前设置 $ page
,例如 -
Set $page
before $marki
, like -
$page = $_GET['page'];
$marki = fopen($page, "rb");
这篇关于使用Php获取网页内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文