Good time to all.

uLogin in the variable $ user ['identity'] displays the full link to the page http://vk.com/id00000000, however, since I am writing the application integration module with the site, I need only numbers. Hence the question. How can I remove all letters / characters (:, /) and leave only numbers?

    3 answers 3

    $id = preg_replace("/[^\d]/","", $src); 

      Pay attention to the page https://ulogin.ru/help.php#fields

      identity is a unique identifier within ulogin (all social networks). In this field there can be, by and large, any data, at least md5-hash.

      profile - link to the user profile. So, if we parse, then it.

      uid - a unique user identifier within the social network . Why don't you use it? And nothing preg_replace'it do not need.

        one.

         $src = 'http://vk.com/id00000000'; preg_match('~\d+~', $src, $m); if (isset($m[0])) { $id = $m[0]; } 

        2

         $src = 'http://vk.com/id00000000'; $pos = strpos($src, 'id'); if ($pos !== false) { $id = substr($src, $pos + 2); }