Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. if (Cookie::get('amoauth') !== null) {
  2.             //COOKIE IS HERE
  3.             $client = new Client();
  4.             $newlead = $client->post('https://domain.amocrm.ru/private/api/v2/json/leads/set', [
  5.                 'add' => [
  6.                     'add/name' => 'TEST LEAD',
  7.                     'add/date_create' => time(),
  8.                     'add/last_modified' => time(),
  9.                     'add/status_id' => '1',
  10.                     'add/price' => 5000
  11.                 ]
  12.             ]);
  13.         } else {
  14.             $client = new Client();
  15.             $auth = $client->post('https://domain.amocrm.ru/private/api/auth.php',[
  16.                 'USER_LOGIN' => 'login',
  17.                 'USER_HASH' => 'hash',
  18.                 'type' => 'json'
  19.             ]);
  20.             $auth = $auth->getHeaders('Set-Cookie');
  21.             Cookie::queue('amoauth', $auth, 15);
  22.             return redirect('/test');
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement