叫我USIG curl_setopt到EVAL來自不同服務器的另一文件,鏈接是這樣的「http://somewhere.com/index.php?vars=hello」變量傳遞到另一個頁面時,它使用curl_setopt
現在在somewhere.com/index.php我需要獲得使用curl傳遞的變量值,但到目前爲止我無法獲得任何值。
這裏是供你參考我的示例代碼是從文件調用somewhere.com:
$d = "http://somewhere.com/index.php?vars=hello";
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch1, CURLOPT_URL, $d);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, TRUE);
$data1 = curl_exec($ch1);
eval($data1);
curl_close($ch1);
在somewhere.com/index.php我已經做的print_r($ _ GET);查看任何傳遞給文件的值,但它不返回任何內容。
也指出沒有錯誤在我的index.php是的print_r($ _ GET)和print_r的($ _ REQUEST);該請求有一個輸出,但沒有得到。也嘗試使用:http://stackoverflow.com/questions/11551599/php-use-curl-to-send-information-to-another-page但仍然無法工作 – magicianiam
嘗試在您的index.php文件中使用此代替直print_r的: '回聲
「;' – Dropzilla對不起它已經有一段時間,因爲我寫的PHP代碼上面的代碼會報錯,使用: '回聲」
「;' – Dropzilla