Get only part of the Cookies string

2

I have the cookie: twid which is returning in the browser as well.

%22u%3D859186139894337536%22

I would like to just get this:

859186139894337536

You can do this in PHP .

PS: I'm getting cookies of Twitter via cURL .

    
asked by anonymous 01.07.2017 / 18:11

1 answer

2

First you should use urldecode to remove the URL characters from your string.

$var = urldecode("%22u%3D859186139894337536%22");

After this you can use the filter_var function that filters your string and returns what you specify:

$var = filter_var($var, FILTER_SANITIZE_NUMBER_INT);

print_r($var);
    
01.07.2017 / 18:20