How to redirect to another page in my site with PHP code?

hossam365 picture hossam365 · Sep 6, 2013 · Viewed 16.5k times · Source

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;
    }

Answer

Jimmy Pelton picture Jimmy Pelton · Sep 6, 2013

You can redirect to a new page using header:

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