0

I want to use the URL of the link that was clicked in a VB.net program. How can I take the url from my browser url bar and use it in my PHP program?

Example:

VB.net - click link then open using a web browser

url: www.something.com/id=^%$#@&var2=13lfhd3f4gt

PHP - put the link in a variable or something so that I can use explode command to get the id and var2 from the URL itself

I need those variables to output a certain value from my database.

Tom Walters
  • 15,366
  • 7
  • 57
  • 74
Tissue
  • 41
  • 1
  • 10

2 Answers2

2

This question has the answer that you are looking for, for getting the url in PHP: Get the full URL in PHP

Though for getting id and var2, it would be simpler to just use the $_GET variable in php. Then you don't have to explode the url and process it. Just change the '/' after 'com' to a ? like: www.something.com?id=^%$#@&var2=13lfhd3f4gt

Community
  • 1
  • 1
Schleis
  • 41,516
  • 7
  • 68
  • 87
  • Sorry, but how do I do it? – Tissue Mar 06 '13 at 15:12
  • For using the $_GET variable, you just go $id = $_GET['id'] and $var2 = $_GET['var2']. You will want to make sure that the values are not null before you use them but that would make your life easier. http://php.net/manual/en/reserved.variables.get.php – Schleis Mar 06 '13 at 15:16
  • So I'll use the program will look like. Please tell me if I'm wrong: $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $leave_id = $_GET['id']; if(!empty($leave_id){ //Run the program } – Tissue Mar 06 '13 at 17:20
0

You can do this using eg. $_SERVER global variable. Please refer to the manual

Voitcus
  • 4,463
  • 4
  • 24
  • 40