TextSendController.php 780 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Http\Controllers\Controller;
  4. use Illuminate\Http\Request;
  5. use Unirest\Request as Unirest;
  6. class TextSendController extends Controller
  7. {
  8. public function store(Request $request)
  9. {
  10. $data = [
  11. 'key' => env('SMS_APIKEY'),
  12. 'user_id' => env('SMS_USER'),
  13. 'sender' => env('SMS_SENDER'),
  14. 'title' => request('title'),
  15. 'msg_type' => request('msg_type', 'sms'),
  16. 'msg' => request('msg'),
  17. 'receiver' => request('receiver'),
  18. ];
  19. $response = Unirest::post(
  20. 'https://apis.aligo.in/send/',
  21. ['Accept' => 'application/json'],
  22. $data,
  23. );
  24. return response()->json($response);
  25. }
  26. }