<?$APPLICATION->ShowTitle();?>
<?$APPLICATION->ShowTitle(false);?>
$text = "Какой то текст [club112773578|+ Подпишись] далее еще текст какой-то...";
$text = preg_replace('/\[(club|public|id)\d*\|.*\]/', '', $text);
//Удалить все в квадратных скобках:
//$text = preg_replace('/\[.*\]/', '', $text);
echo $text; // Какой то текст далее еще текст какой-то...
************************************************************************************************************ $text = "Какой то текст [club112773578|+ Подпишись] далее еще текст какой-то...";
$text = preg_replace('/\[.*\|.*\]/', '', $text);
echo $text; // Какой то текст далее еще текст какой-то...
Открыть чат, работает только по имени пользователя:
<a href="tg://resolve?domain=имя_пользователя">Telegram</a>
или
<a href="https://t.me/имя_пользователя">Telegram</a>
Приглашение в групповой чат по инвайту:
<a href="tg://join?invite=id_группы">Telegram</a>
Открыть чат с номером:
<a href="whatsapp://send?phone=+7903xxxxxxx">WhatsApp</a>
или
<a target="_blank" href="https://wa.me/+7903xxxxxxx">WhatsApp</a>
Открыть чат с номером и написать сообщение:
<a href="whatsapp://send?phone=+7903xxxxxxx&text=Hello world!">WhatsApp</a>
Поделится текстом, в приложение откроется список контактов для отправки:
<a href="whatsapp://send?text=Hello world!">WhatsApp</a>
Некоторые причины возникновения ошибки:
utf8mb4_0900_ai_ci
. Замените её на utf8mb4_general_ci
или utf8mb4_unicode_ci
.
utf8mb4_0900_ai_ci на
utf8mb4_general_ci.
utf8mb4 на
utf8
<?php
$url = 'https://id.vk.com/oauth2/auth';
$data = [
'grant_type' => 'refresh_token',
'refresh_token' => 'vk2.много букв и цифр',
'client_id' => '11111111',
'device_id' => 'много букв и цифр',
'state' => 'XXXRandomZZZ1111111111111111XXXRandomZZZ',
'scope' => 'vkid.personal_info photos wall offline'
];
// Prepare POST data
$options = [
'http' => [
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded',
'content' => http_build_query($data),
],
];
// Create stream context
$context = stream_context_create($options);
// Perform POST request
$response = file_get_contents($url, false, $context);
file_put_contents(__DIR__ . '/vk_tmp.txt', print_r($response, true));
// Display the response
echo $response;
echo '<br>';
$array = json_decode($response, true);
print_r($array);
?>
<?
$tmp_access_data = file_get_contents(__DIR__ . '/vk_tmp.txt');
// json to array
$array_access_data = json_decode($tmp_access_data, true);
$refresh_token = $array_access_data['refresh_token'];
// Define the URL and data
$url = 'https://id.vk.com/oauth2/auth';
$data = [
'grant_type' => 'refresh_token',
'refresh_token' => $refresh_token,
'client_id' => '11111111',
'device_id' => 'много букв и цифр',
'state' => 'XXXRandomZZZ1111111111111111XXXRandomZZZ',
'scope' => 'vkid.personal_info photos wall offline'
];
// Prepare POST data
$options = [
'http' => [
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded',
'content' => http_build_query($data),
],
];
// Create stream context
$context = stream_context_create($options);
// Perform POST request
$response = file_get_contents($url, false, $context);
file_put_contents(__DIR__ . '/vk_tmp.txt', print_r($response, true));
// json to array
$array_access_data_new = json_decode($response, true);
$access_token = $array_access_data_new['access_token'];
?>
"
curl "https://id.vk.com/oauth2/auth" -d "client_id=11111111&grant_type=authorization_code&code_verifier=S7yz7Uw_d4B68xGmpVLNqKSCHvGDL9YXuq6Nf1rEi4w&device_id=много букв и цифр&code=vk2.много букв и цифр&redirect_uri=https://site.ru&state=XXXRandomZZZ1111111111111111XXXRandomZZZ"