/
home
/
sjslayjy
/
public_html
/
mosaram
/
app
/
Http
/
Controllers
/
Upload File
HOME
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Auth; use App\Models\LocalUserMapping; use App\Models\Invoice; use App\Imports\ItemImport; use Excel; class e_invoiceController extends Controller { public function __construct() { $ip = $_SERVER['REMOTE_ADDR']; $ip_address = 'ip_address: ' . $ip; $authurl = 'https://einv-apisandbox.nic.in/v1.04/auth'; $headers = array( 'client_id: a523ad5f-c0f9-43b3-be2b-fb50c467359d', 'client_secret: ad1681cb-656b-4ab5-b477-d853b0d15464', 'gstin : 09AAGFM8408G1Z4', ); $payload = array(json_encode(base64_encode( 'content-type: application/json;charset=UTF-8', 'username: ', 'password: ', $ip_address, 'client_id: a523ad5f-c0f9-43b3-be2b-fb50c467359d', 'client_secret: ad1681cb-656b-4ab5-b477-d853b0d15464', 'gstin : 09AAGFM8408G1Z4 ', ))); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $authurl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); $season_data = curl_exec($ch); if (curl_errno($ch)) { print "Error: " . curl_error($ch); exit(); } curl_close($ch); $json = json_decode($season_data, true); if ($json['status_cd'] == "Sucess") { // $data = ['AuthToken' => $AuthToken, 'states' => $states]; // return view('finance.generate-invoice', $data); } } }