另一個編輯
這裏試試這個代碼。郵政實施。
$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 /服務器/託管允許您請求任意頁面(您的域之外的文件/發送請求到服務器)? –