Page 1 of 1
getting info from HTTP line
Posted: Wed Nov 02, 2011 1:22 pm
by fonsy2000
Hello guys,
I am starting with some easy php projects and I would like to ask some questions here, probably dum question
for example, using
http://webpage.com/folder/bob
How can I get bob information from my database (mysql) using php, Can I?
$name = 'bob';
and search in the database
thank you for you help
ale
Re: getting info from HTTP line
Posted: Wed Nov 02, 2011 2:18 pm
by manohoo
Code: Select all
// get the url, slice it and store in array
$url = "http://webpage.com/folder/bob";
$url = rtrim($url, '/');
$url = explode('/', $url);
/// now you have an array, you can take it from here
var_dump($url);
Re: getting info from HTTP line
Posted: Wed Nov 02, 2011 4:48 pm
by fonsy2000
manohoo wrote:Code: Select all
// get the url, slice it and store in array
$url = "http://webpage.com/folder/bob";
$url = rtrim($url, '/');
$url = explode('/', $url);
/// now you have an array, you can take it from here
var_dump($url);
Thank you and I am sorry for it wasn't clear before.
I mean, if I (ale) go to mywebsite.com I will type in the browser
http://mywebsite.com/ale, then I want to use the "ale" to find in my database
How get that part for everyone go to my website
http://mywebsite.com/bob
http://mywebsite.com/grek
....
Thanks again
Re: getting info from HTTP line
Posted: Thu Nov 03, 2011 8:27 am
by fonsy2000
Any?
Re: getting info from HTTP line
Posted: Sat Nov 05, 2011 9:45 pm
by fonsy2000
manohoo wrote:Code: Select all
// get the url, slice it and store in array
$url = "http://webpage.com/folder/bob";
$url = rtrim($url, '/');
$url = explode('/', $url);
/// now you have an array, you can take it from here
var_dump($url);
now was when I understood the script, work perfect, took me some time to analyzed

remember I am starting
Thank you