2012-04-12 51 views
0

以下是我使用通過外部網站發送短信URL的一個例子:打開外部URL,並繼續我自己的網頁

http://bulksms.poweredsms.com/send.php?usr=rajdeeps&pwd=pass123&ph=xxxxxxxxxxx&sndr=textid&text=hi

但是,如果我將用戶重定向到這個網址,他們不會被重定向回我的網站。 但是我有代碼執行/頁面顯示發送消息。

如何加載URL發送消息而不失去對用戶顯示內容的控制?

+0

如果你想用HTML做/ JavaScript的,你可以使用AJAX http://stackoverflow.com/questions/9069539/get-result-from-php-file-without-usig-jquery/9069599# 9069599。但你不應該這樣做。你應該使用curl http://php.net/manual/de/book.curl.php – 2012-04-12 17:05:40

回答

5

你會想在服務器端做到這一點,例如cURL

// create curl resource 
    $ch = curl_init(); 

    // set url 
    curl_setopt($ch, CURLOPT_URL, "http://bulksms.poweredsms.com/send.php?usr=rajdeeps&pwd=pass123&ph=xxxxxxxxxxx&sndr=textid&text=hi"); 

    //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); 

    // $output now contains the response from poweredsms.com 
+0

錯誤:未定義函數curl_init(), 我應該怎麼做(包括lib?) – 2012-04-12 17:15:15

+0

哦,我需要啓動php_curl從wamp 。 非常感謝... – 2012-04-12 17:19:42

相關問題