Redirect to external URL with return in laravel

后端 未结 8 1456
野的像风
野的像风 2021-02-01 13:41

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/pushs

8条回答
  •  难免孤独
    2021-02-01 14:13

    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;
    

提交回复
热议问题