post_id2#access_key=1654040333
access_key
is not regular query parameter you'd obtain using i.e.$_GET
. It's webpage anchor reference used (by design by browsers, but nowadays also by JS frameworks etc). You however are not fully lost as there's parse_url() function that can parse this for you. So:
$url = 'http://localhost/sample/?post_id2#access_key=1654040333';
var_dump(parse_url($url));
would return you the following array:
array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
string(9) "localhost"
["path"]=>
string(8) "/sample/"
["query"]=>
string(8) "post_id2"
["fragment"]=>
string(21) "access_key=1654040333"
}
so your access_key
will be in fragment
key, so you may process it further to get the value:
$parse_url_result = parse_url($_SERVER['QUERY_STRING']);
if (array_key_exists('fragment', $parse_url_result)) {
$tmp = explode('=', $parse_url_result['fragment']);
$access_key = $tmp[1];
}