有没有开源的 PHP Web 代理可供使用?
我需要一个 PHP Web 代理来读取 html、向用户显示并重写所有链接,以便当用户单击下一个链接时,代理将再次处理请求,就像此代码一样,但另外还需要重写所有链接链接。
<?php
// Set your return content type
header('Content-type: text/html');
// Website url to open
$daurl = 'http://www.yahoo.com';
// Get that website's content
$handle = fopen($daurl, "r");
// If there is something, read and return
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
}
?>
我希望我已经解释得很好了。这个问题是为了不要重新发明轮子。
另一个附加问题。这种代理可以处理Flash之类的内容吗?
I need a PHP Web Proxy that read html, show to the user and rewrite all the links for when the user click in the next link the proxy will handle the request again, just like this code, but with additionaly sould make the rewrite of all the links.
<?php
// Set your return content type
header('Content-type: text/html');
// Website url to open
$daurl = 'http://www.yahoo.com';
// Get that website's content
$handle = fopen($daurl, "r");
// If there is something, read and return
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
}
?>
I hope I have explained well. This question is for not reinventing the wheel.
Another additional question. This kind of proxies will deal with contents like Flash?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于开源解决方案,请查看 PHProxy。我过去用过它,据我记忆,它似乎工作得很好。
For an open source solution, check out PHProxy. I've used it in the past and it seemed to work quite well from what I can remember.
它会起作用,你需要重写任何相对路径到绝对路径,我认为cookie在这种情况下不起作用。使用 cURL 进行此操作...
It will sort of work, you need to rewrite any relative path to apsolute, and I think cookies won't work in this case. Use cURL for this operations...