打开外部URL并继续使用我自己的网页

时间:2012-04-12 17:03:57

标签: php javascript url

以下是我用来通过外部网站发送短信的网址示例:

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

但是,如果我将用户重定向到此网址,则不会将其重定向回我的网站。 但是我有代码来执行/页面显示发送消息。

如何在不失去对用户显示内容的控制权的情况下加载发送邮件的URL?

1 个答案:

答案 0 :(得分: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