Untitled
unknown
plain_text
3 years ago
1.7 kB
15
Indexable
public function apiData()
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api-test-studnt.com/v2/c/Neewcollegedata-Api?accessKey=u$r96fc2eaae2363ad6646ac5d5799dafb&secretKey=1bfb068504a7a2d2bb9e41dc0cf',
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": "2017-01-01 02:20:00"
},
"Columns": {
"Include_CSV": "mx_Street1,mx_Street2"
},
"Paging": {
"PageIndex": 10,
"PageSize": 500
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
$data = json_decode($response, true);
if (!empty($data)) {
foreach ($data as $key => $user) {
Api::create([
'name' => $data['mx_Street1'],
'email' => $data['mx_Street2'],
'user_id' => bcrypt('123456789')
]);
}
}
return 0;
}Editor is loading...