2011-05-19 52 views
1

非常新手的問題:建立一個Meraki無線EXCAP圍牆花園,並將有用戶登陸service.php(簡單的複選框)......提交後,將登陸其他信息的頁面,然後需要通過打開網頁。需要抓取第一個URL,保存它,傳遞給page2.php,然後轉到網頁。PHP如何通過URL參數創建一個新的URL

傳入URL的Meraki的的例子(當用戶試圖訪問無線):

http://MyCompany.com/MerakiSplashPage/?base_grant_url=https://example.meraki.com/splash/grant&user_continue_url=http://www.google.com&node_id=222222&gateway_id=222222&client_ip=10.222.222.222 

然後「當您準備授予訪問權限的用戶,向用戶發送到GET['base_grant_url'] + "?continue_url=" + GET['user_continue_url']在這個例子的情況下,以上,這個網址是:

https://example.meraki.com/splash/grant?continue_url=http://www.google.com 

兜兜如何做到這一點,任何建議將不勝感激

+0

那麼,什麼網頁或網頁你寫作?也許如果你可以更清楚地瞭解用戶將要瀏覽的系列頁面以及需要幫助的頁面。 – jedwards 2011-05-19 17:37:18

回答

3

使用rawurlencode編碼正確的值:

'http://MyCompany.com/MerakiSplashPage/?base_grant_url='.rawurlencode('https://example.meraki.com/splash/grant&user_continue_url=http://www.google.com').'&node_id=222222&gateway_id=222222&client_ip=10.222.222.222' 

您還可以使用http_build_query自動生成查詢:

$query = array(
    'base_grant_url' => 'https://example.meraki.com/splash/grant&user_continue_url=http://www.google.com', 
    'node_id' => '222222', 
    'gateway_id' => '222222', 
    'client_ip' => '10.222.222.222' 
); 
'http://MyCompany.com/MerakiSplashPage/?'.http_build_query($query) 
+0

感謝Gumbo&Babiker,我嘗試使用parse_url並且沒有到達任何地方,我的方向錯了。將嘗試這些......謝謝! – Muonwar 2011-05-21 18:27:26

0

最終網址是:

$_GET['base_grant_url']."?".$_GET['user_continue_url'];