Redirect to external URL with return in laravel Redirect to external URL with return in laravel php php

Redirect to external URL with return in laravel


You should be able to redirect to the url like this

return Redirect::to($url);

You can read about Redirects in the Laravel docs here.


For Laravel 5.x and above

return redirect()->away('https://www.google.com');

as stated in the docs:

Sometimes you may need to redirect to a domain outside of yourapplication. You may do so by calling the away method, which creates aRedirectResponse without any additional URL encoding, validation, orverification:


Define the url you want to redirect in $url

Then just use

return Redirect::away($url);

If you want to redirect inside your views use

return Redirect::to($url);

Read more about Redirect here

Update 1 :

Here is the simple example

return Redirect::to('http://www.google.com');

Update 2 :

As the Questioner wants to return in the same page

$triggersms = file_get_contents('http://www.cloud.smsindiahub.in/vendorsms/pushsms.aspx?user=efg&password=abcd&msisdn=9197xxx2&sid=MYID&msg=Hello');return $triggersms;