0

This is bulk SMS sending code, and it works good and sends messages, but after sending a message, the web browser redirects me to code in a white page.

I want after sending a message to redirect to another page on my site.

$username = '';
    $password = '';
    $client = new SoapClient('http://www.xxxx/xx');
    $numbers = 'xxxx ';
    $message = 
    'hi this is a test 
    !@#$%^&*
    ';
    $senderName = 'xxxxxx';
    try {
    $response = $client->sendSMS($username, $password, $numbers, $message, $senderName);
    var_dump($response);
    } catch(SoapFault $exception ) {
    echo $exception->faultcode . ' : ' .$exception->faultstring . PHP_EOL;
    }
hossam365
  • 11
  • 1
  • 1
  • 2

6 Answers6

5

You can redirect to a new page using header:

header('Location: http://www.yoursite.com/new_page.html');
Jimmy Pelton
  • 11
  • 3
  • 16
  • I TRY THQT BUT DONT WORK – hossam365 Sep 06 '13 at 19:50
  • Make sure you put it in your code right after the `$response = $client->sendSMS($username, $password, $numbers, $message, $senderName); var_dump($response);` – Jimmy Pelton Sep 06 '13 at 20:01
  • Warning: Cannot modify header information - headers already sent by (output started at /home/content/43/11678743/html/click/sms.php:9) in /home/content/43/11678743/html/click/sms.php on line 19 – hossam365 Sep 06 '13 at 23:31
  • @hossam365 You obviously have output above one of your files and could be inside one of your included files. Anything above ` – Funk Forty Niner Sep 06 '13 at 23:50
2

you can use...

header('Location: your_url.php');

or you also use

?>
<script> window.location="your_url.php" </script>   
<?php 
Byndd IT
  • 297
  • 2
  • 12
0

Use this code

header('Location: http://www.yoursite.com/new_page.html');

But remember that it won't work if there's any output already sent by php script. If so, you will get warning (check your error_reporting and display_errors in php.ini). So, in other words, you can't put it after var_dump because var_dump produces output. It might be also a good idea to put exit() after var_dump.

Tomasz Madeyski
  • 10,742
  • 3
  • 50
  • 62
0

Use this PHP code header ('location:http://www.google.com')

and this javascript code:

<script>
    window.location = 'http://www.google.com'   
</script>
Gilles
  • 9,269
  • 4
  • 34
  • 53
Asad Mukhtar
  • 391
  • 6
  • 18
0
$username = '';
    $password = '';
    $client = new SoapClient('http://www.google.com/xx');
    $numbers = '8899';
    $message = 
    'hi check it
    !@#$%^&*
    ';
    $senderName = 'Winder';
    try {
    $response = $client->sendSMS($username, $password, $numbers, $message, $senderName)
    var_dump($response);
    } catch(SoapFault $exception ) {
    echo $exception->faultcode . ' : ' .$exception->faultstring . PHP_EOL;
    }
Swap
  • 1
  • 2
0
----------
<?php
echo '<div style="text-align:center;padding-top:200px;">Go New Page</div>'; // Show Message
        $gourl='http://stackoverflow.com'; // goto url
        echo '<META HTTP-EQUIV="Refresh" Content="2; URL='.$gourl.'">'; //   Content= Redirect time (seconds)
        exit;

?>
----------
Waruna Manjula
  • 3,067
  • 1
  • 34
  • 33