2010-09-03 19 views

回答

0

您可以創建一個名爲proxy.php的頁面,或者類似將URL作爲參數的頁面。然後,您可以用URL中的otherdomain.org代替domain.org。然後使用CURL獲取內容並將其返回。

1

http://www.php.net/manual/en/curl.examples-basic.php#88055,這是你需要的代碼:

<?php 
    // create curl resource 
    $ch = curl_init(); 

    // set url 
    curl_setopt($ch, CURLOPT_URL, "example.com"); 

    //return the transfer as a string 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

    // $output contains the output string 
    $output = curl_exec($ch); 

    // close curl resource to free up system resources 
    curl_close($ch);  
?> 
+0

我在關閉前添加了echo $輸出。 – 2010-09-03 23:58:16