1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
requestfacebook.php
См. документацию.
1
<?
2
3
namespace
Bitrix\Seo\Retargeting\Services;
4
5
use Bitrix\Main\Web\Json;
6
use Bitrix\Seo\Service;
7
use Bitrix\Seo\Retargeting\ProxyRequest;
8
9
class
RequestFacebook
extends
ProxyRequest
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
{
79
return
$this->
getServiceUrl
(
Service::SERVICE_URL
);
80
}
81
}
Bitrix\Seo\Retargeting\ProxyRequest
Определения
proxyrequest.php:9
Bitrix\Seo\Retargeting\ProxyRequest\getServiceUrl
getServiceUrl(string $sourceUrl)
Определения
proxyrequest.php:71
Bitrix\Seo\Retargeting\Services\RequestFacebook
Определения
requestfacebook.php:10
Bitrix\Seo\Retargeting\Services\RequestFacebook\TYPE_CODE
const TYPE_CODE
Определения
requestfacebook.php:11
Bitrix\Seo\Retargeting\Services\RequestFacebook\REST_METHOD_PREFIX
const REST_METHOD_PREFIX
Определения
requestfacebook.php:12
Bitrix\Seo\Retargeting\Services\RequestFacebook\getProxyUrl
getProxyUrl()
Определения
requestfacebook.php:77
Bitrix\Seo\Retargeting\Services\RequestFacebook\directQuery
directQuery(array $params=array())
Определения
requestfacebook.php:14
Bitrix\Seo\Service\SERVICE_URL
const SERVICE_URL
Определения
service.php:40
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$page
$page
Определения
order_form.php:33
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
$url
$url
Определения
iframe.php:7
bitrix
modules
seo
lib
retargeting
services
requestfacebook.php
Создано системой
1.14.0