I have this url:
If you know your url's will always be in this structure, you can parse it out with RegEx like so:
$url = '/?goto=%2Fr%2Faccount%2Findex%2Ecfm%3Fsite_id%3D87211'; preg_match('/site_id\%3D(\d+)/', $url, $matches); $siteId = $matches;
It's searching for anything that matches
site_id%3D and the numeric value that follows that.