Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (Cookie::get('amoauth') !== null) {
- //COOKIE IS HERE
- $client = new Client();
- $newlead = $client->post('https://domain.amocrm.ru/private/api/v2/json/leads/set', [
- 'add' => [
- 'add/name' => 'TEST LEAD',
- 'add/date_create' => time(),
- 'add/last_modified' => time(),
- 'add/status_id' => '1',
- 'add/price' => 5000
- ]
- ]);
- } else {
- $client = new Client();
- $auth = $client->post('https://domain.amocrm.ru/private/api/auth.php',[
- 'USER_LOGIN' => 'login',
- 'USER_HASH' => 'hash',
- 'type' => 'json'
- ]);
- $auth = $auth->getHeaders('Set-Cookie');
- Cookie::queue('amoauth', $auth, 15);
- return redirect('/test');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement