具有持久URL的简单PHP代理

具有持久URL的简单PHP代理,php,curl,proxy,request,echo,Php,Curl,Proxy,Request,Echo,我有一个简单的PHP脚本: <?php $url = $_REQUEST['url']; if (preg_match('/\b(https?|ftp):\/\/*/', $url) !== 1) die; echo (file_get_contents($url)); ?> 但回声显示: http://forum.bodybuilding.com/showthread.php?t=162984431 例如: 我不是PHP专家,但我认为这与持久URL有关?我将如何着手修复此问题

我有一个简单的PHP脚本:

<?php
$url = $_REQUEST['url'];
if (preg_match('/\b(https?|ftp):\/\/*/', $url) !== 1) die;
echo (file_get_contents($url));
?>
但回声显示:

http://forum.bodybuilding.com/showthread.php?t=162984431
例如:

我不是PHP专家,但我认为这与持久URL有关?我将如何着手修复此问题,以便回声也显示&符号后面的所有内容?如果有帮助的话,我的服务器上确实安装了cURL。谢谢

这里的“&”符号是查询字符串元素的一部分。因此,它将避免从第一个“&”中获取值。我们可以在你的脚本上多写两行来完成工作

<?php
$query=$_SERVER['QUERY_STRING'];  //get the full query string in url
$query_arr=explode("url=",$query);  //split the string by first get key

$url = $query_arr[1];  //take second parameter as url to be loaded
if (preg_match('/\b(https?|ftp):\/\/*/', $url) !== 1) die;
echo (file_get_contents($url));
?>

she脚本作为工作脚本在以下url中可用

<?php
$query=$_SERVER['QUERY_STRING'];  //get the full query string in url
$query_arr=explode("url=",$query);  //split the string by first get key

$url = $query_arr[1];  //take second parameter as url to be loaded
if (preg_match('/\b(https?|ftp):\/\/*/', $url) !== 1) die;
echo (file_get_contents($url));
?>