Показать сообщение отдельно
  #2 (permalink)  
Старый 03.03.2018, 11:18
Профессор
Отправить личное сообщение для Nexus Посмотреть профиль Найти все сообщения от Nexus
 
Регистрация: 04.12.2012
Сообщений: 3,726

<?php
    $response='https://api.vk.com/blank.html#access_token=12345678900987654321&expires_in=0&user_id=123456789';
    $token=preg_replace('#.+access_token=([^&]+?)&.+#uim','$1',$response);
    echo $token, PHP_EOL;
    
    $token=explode('#',$response,2);
    $token=array_reduce(explode('&',end($token)),function($res,$item){
        $item=explode('=',$item);
        $res[reset($item)]=end($item);
        
        return $res;
    },array());
    $token=$token['access_token'];
    echo $token;
http://sandbox.onlinephpfunctions.co...b79f0460dc551f

Последний раз редактировалось Nexus, 03.03.2018 в 11:20.
Ответить с цитированием