另一个编辑
这里试试这个代码。邮政实施。
$url = $_GET["url"];
$method = $_SERVER["REQUEST_METHOD"];
$data = array($_POST);
$options = array(
"http" => array(
"header" => "Content-type: application/x-www-form-urlencoded\r\n",
"method" => $method,
"content" => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$filter = "/(http|https|ftp|ftps)(:\/\/)/i";
$result = preg_replace($filter, "http://YOURDOMAIN.com/FOLDER/LOCATIONOFTHEPROXY.php?url=$1$2", $result);
echo $result;
var_dump($result);
编辑
Here我发现一些代码,使用PHP为POST。现在只需要实施它。
<?php
$url = "url to post to;
$data = array("comment" => "Testing PhP Post", "name" => "A PhP Script");
// use key "http" even if you send the request to https://...
$options = array(
"http" => array(
"header" => "Content-type: application/x-www-form-urlencoded\r\n",
"method" => "POST",
"content" => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
echo $result;
var_dump($result);
?>
你试过file_get_contents()
?
试试这个:
<?php
echo file_get_contents($_GET["url"]);
?>
呼叫与像?url=http://google.com/
查询该文件。
糟糕!它是'file_get_contents',而不是'get_file_contents'。 –
是的,我尝试了很多变化,这是行不通的 –
您的PhP /服务器/托管允许您请求任意页面(您的域之外的文件/发送请求到服务器)? –