Untitled
unknown
plain_text
2 years ago
2.0 kB
3
Indexable
public function apiData() { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api-in21.leads.com/v2/LeadManagement?accessKey=ac5d57969dafb&secretKey=1bfb4a20863fcf1fd2bb9e41dc0cf', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "Parameter": { "FromDate": "2016-09-05 02:00:00", "ToDate": "2023-01-01 02:20:00" }, "Columns": { "Include_CSV": "ProspectID,FirstName,LastName,EmailAddress" }, "Paging": { "PageIndex": 1, "PageSize": 5000 } }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), )); $response = curl_exec($curl); curl_close($curl); $response = json_decode($response, true); foreach($response as $data) { DB::table('apis') ->insert( ['ProspectID'=>$data['user_id']], ['FirstName'=>$data['fullname']], ['EmailAddress'=>$data['email']] ); } }
Editor is loading...