Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect to external URL with return in laravel

I am trying to send one time password to a user using SMS INDIA HUB API. For that purpose I need to redirect to a URL format:

http://cloud.smsindiahub.in/vendorsms/pushsms.aspx?user=abc&password=xyz&msisdn=919898xxxxxx&sid=SenderId&msg=test%20message&fl=0&gwid=2

If we load this URL, it will return some message. I need to get that message to.

I tried like this

$url = "http://cloud.smsindiahub.in/vendorsms/pushsms.aspx?user=wwww&password=eee&msisdn=9197xxxxx&sid=yyyyy&msg=rrrrr&fl=0&gwid=2";  return Redirect::intended($url); 

But it is not directing to that link. It tries to load that URL in localhost.

Or is there any plugin to send sms using SMS INDIA HUB?

Can anyone help??

like image 690
manoos Avatar asked Feb 21 '15 06:02

manoos


People also ask

How do I redirect in Laravel?

Redirecting to Controller Actions Not only named route but we can also redirect to controller actions. We need to simply pass the controller and name of the action to the action method as shown in the following example. If you want to pass a parameter, you can pass it as the second argument of the action method.

How would you redirect back to a controller action?

Redirect to a Controller Action The last piece of the puzzle is that you can redirect to a specific Method of a specific Controller, no matter what its Route or URL is – use method action(): return redirect()->action('App\Http\Controllers\BooksController@index');


1 Answers

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.

like image 111
Laurence Avatar answered Oct 10 '22 02:10

Laurence