Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. <?php
  2.     $ya_client_id = "taxi/park/be25363d52c644f9b05daa451e1816df";
  3.     $ya_api = "AIzvufB/saacjW+npx/YeOpyzXShrwPzZlvZcku";
  4.     $park_id = "be25363d52c644f9b05daa451e1816df";
  5.  
  6.     $url = "https://fleet-api.taxi.yandex.net/v1/parks/driver-profiles/list";
  7.  
  8.     $count_strings = 1000;
  9.     $page = 0;
  10.  
  11.     $post_data = '{
  12.        "limit": '.$count_strings.',
  13.        "offset": '.$page.',
  14.        "query": {
  15.            "park": {
  16.                "id": "'.$park_id.'",
  17.                "driver_profile": {
  18.                    "work_status": [
  19.                        "working"
  20.                    ]
  21.                }
  22.            }  
  23.        },
  24.        "fields": {
  25.            "account": [
  26.                 "balance",
  27.                 "balance_limit"
  28.             ],
  29.             "driver_profile": [
  30.                 "phones"
  31.             ],
  32.             "car": []
  33.        },
  34.        "sort_order": [
  35.            {
  36.                "direction": "asc",
  37.                "field": "driver_profile.created_date"
  38.            }
  39.        ]
  40.    }';
  41.  
  42.     $curl = curl_init();
  43.     curl_setopt_array($curl, [
  44.         CURLOPT_URL => $url,
  45.         CURLOPT_RETURNTRANSFER => true,
  46.         CURLOPT_ENCODING => "",
  47.         CURLOPT_MAXREDIRS => 10,
  48.         CURLOPT_TIMEOUT => 0,
  49.         CURLOPT_FOLLOWLOCATION => false,
  50.         CURLOPT_CUSTOMREQUEST => "POST",
  51.         CURLOPT_POSTFIELDS => $post_data,
  52.         CURLOPT_HTTPHEADER => [
  53.             "Accept: application/json",
  54.             "Content-Type: application/json",
  55.             "X-Client-ID: $ya_client_id",
  56.             "X-API-Key: $ya_api",
  57.             "Accept-Language: ru"
  58.         ],
  59.     ]);
  60.  
  61.     $response = curl_exec($curl);
  62.     curl_close($curl);
  63.  
  64.     $json = json_decode($response, true);
  65.     var_dump($json);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement