1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
requestfacebook.php
См. документацию.
1<?
2
3namespace Bitrix\Seo\Retargeting\Services;
4
5use Bitrix\Main\Web\Json;
6use Bitrix\Seo\Service;
7use Bitrix\Seo\Retargeting\ProxyRequest;
8
10{
11 const TYPE_CODE = 'facebook';
12 const REST_METHOD_PREFIX = 'seo.client.ads.facebook';
13
14 protected function directQuery(array $params = array())
15 {
16 $url = 'https://graph.facebook.com/v8.0/';
17 $url .= $params['endpoint'];
18
19 $clientParameters = is_array($params['fields']) ? $params['fields'] : array();
20 $clientParameters = $clientParameters + array('access_token' => $this->adapter->getToken());
21
22 $result = '';
23 if ($params['method'] == 'GET')
24 {
25 $url .= '?' . http_build_query($clientParameters, "", "&");
26 $result = $this->client->get($url);
27 }
28 elseif ($params['method'] == 'DELETE')
29 {
30 $result = $this->client->delete($url, $clientParameters, true);
31 }
32 else
33 {
34 $result = $this->client->post($url, $clientParameters, true);
35 }
36 if (!$params['has_pagination'])
37 return $result;
38
39 try
40 {
41 $partialResult = $result;
42 $result = [];
43 $page = 1;
44 do
45 {
46 $decodedResult = Json::decode($partialResult);
47 $nextPage = ($decodedResult['paging'] && $decodedResult['paging']['next']) ? $decodedResult['paging']['next'] : false;
48 unset($decodedResult['paging']);
49
50 $result = array_merge_recursive($result, $decodedResult);
51
52 if ($nextPage)
53 {
54 $this->client->query($params['method'], $nextPage);
55 $partialResult = $this->client->getResult();
56 $page++;
57 }
58 else
59 {
60 if ($page == 1) // if haven't ['paging']['next'] in original response
61 {
62 return $partialResult;
63 }
64 break;
65 }
66 }
67 while($nextPage && $page < 20); // max 500 items
68
69 return Json::encode($result);
70 }
71 catch (\Exception $e)
72 {
73 return $result;
74 }
75 }
76
77 public function getProxyUrl(): string
78 {
80 }
81}
getServiceUrl(string $sourceUrl)
Определения proxyrequest.php:71
directQuery(array $params=array())
Определения requestfacebook.php:14
const SERVICE_URL
Определения service.php:40
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$page
Определения order_form.php:33
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$url
Определения iframe.php:7