打开一个外部 URL 并继续我自己的网页

Open an external URL and continue with my own webpages

本文关键字:URL 继续 我自己 网页 自己的 外部 一个      更新时间:2023-09-26

以下是我用于通过外部站点发送短信的URL示例:

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

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

如何加载 URL 以发送消息,而不会失去对向用户显示的内容的控制?

您需要在服务器端执行此操作,例如使用 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