1
我正在一個不接受請求(get/post)遠程域的linux服務器上工作。就像,如果我在另一個域上使用表單並將其發佈到此服務器上的腳本中,它就不會處理它。我想知道我必須啓用哪些選項才能完成此操作,以便它能夠接受遠程請求?這是在php.ini中的東西?接受遠程域獲取/發佈請求
問候
我正在一個不接受請求(get/post)遠程域的linux服務器上工作。就像,如果我在另一個域上使用表單並將其發佈到此服務器上的腳本中,它就不會處理它。我想知道我必須啓用哪些選項才能完成此操作,以便它能夠接受遠程請求?這是在php.ini中的東西?接受遠程域獲取/發佈請求
問候
如果Web服務器通過塊引用的職位,你需要找到一種方法,從您的網站發送引用。首先將帖子發送到腳本,然後從該腳本發送到您的站點,這會讓您有可能僞造引薦者請求標頭。
例如PHP代理的下面的代碼就是從這裏借:http://snipplr.com/view/16058/php-url-proxy/
<?php
// PHP Proxy
// Responds to both HTTP GET and POST requests
//
// Author: Abdul Qabiz
// March 31st, 2006
//
// Get the url of to be proxied
// Is it a POST or a GET?
$url = ($_POST['url']) ? $_POST['url'] : $_GET['url'];
$headers = ($_POST['headers']) ? $_POST['headers'] : $_GET['headers'];
$mimeType =($_POST['mimeType']) ? $_POST['mimeType'] : $_GET['mimeType'];
//Start the Curl session
$session = curl_init($url);
// If it's a POST, put the POST data in the body
if ($_POST['url']) {
$postvars = '';
while ($element = current($_POST)) {
$postvars .= key($_POST).'='.$element.'&';
next($_POST);
}
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars);
}
// Don't return HTTP headers. Do return the contents of the call
curl_setopt($session, CURLOPT_HEADER, ($headers == "true") ? true : false);
curl_setopt($session, CURLOPT_FOLLOWLOCATION, true);
//curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// Make the call
$response = curl_exec($session);
// NOTE: HERE YOU WILL OVERRIDE THE REFERRER REQUEST HEADER
if ($mimeType != "")
{
// The web service returns XML. Set the Content-Type appropriately
header("Content-Type: ".$mimeType);
}
echo $response;
curl_close($session);
?>
這樣的水煤漿通過網絡服務器最有可能配置。我會使用mod_rewrite與Apache,如果我不得不阻止來自其他域的帖子,而不是PHP。 – Spliffster 2011-02-01 18:56:19