另一个编辑
在这里试试这个代码。发布已实现。
$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/ 之类的查询调用文件。