This question has already been answered:

There are links with such endings.

?w=wall239752675_488 ?z=photo239752675_384467374 

how to check

if there is w then we do that

if there is z then we do that

The condition can of course be written with the help of if else. But how to get from the link is w and z I won’t even build the mind.

Reported as a duplicate by members of Visman , Qwertiy , BOPOH , torokhkun , Alex 27 Oct '15 at 10:46 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • if (isset($_REQUEST['w'])) {...} , in your case, instead of $ _REQUEST, you can use $ _GET - BOPOH
  • We check the link, if it has GET w or z, then we do it and if not, then we do not do it. The link itself is stored in a variable - Anatoly
  • one
    @Anatoly, go learn the basics of php . - Visman
  • five
    Once the link is in a variable, this is a duplicate of the question: How to get the id parameter from the link? - Visman

1 answer 1

Solved my problem so

have url

 $url = "https://vk.com/id239752675?w=wall239752675_488"; 

I parse it and get the GET request itself

 $parts = parse_url($url); $qry = $parts['query']; $var = $qry; 

Further, with the link rather with w = wall239752675_488 I cut everything that is after the = sign

 $test_url = preg_replace("/(=.*)$/", "", $var); 

And then I check

 if($test_url == "w") { echo "Равна"; } else { echo "Не равна"; } 

Thanks for all the help.