getting info from HTTP line

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fonsy2000
Forum Newbie
Posts: 4
Joined: Wed Nov 02, 2011 1:10 pm

getting info from HTTP line

Post by fonsy2000 »

Hello guys,

I am starting with some easy php projects and I would like to ask some questions here, probably dum question :D

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
User avatar
manohoo
Forum Contributor
Posts: 201
Joined: Wed Dec 23, 2009 12:28 pm

Re: getting info from HTTP line

Post 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);
fonsy2000
Forum Newbie
Posts: 4
Joined: Wed Nov 02, 2011 1:10 pm

Re: getting info from HTTP line

Post 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
fonsy2000
Forum Newbie
Posts: 4
Joined: Wed Nov 02, 2011 1:10 pm

Re: getting info from HTTP line

Post by fonsy2000 »

Any?
fonsy2000
Forum Newbie
Posts: 4
Joined: Wed Nov 02, 2011 1:10 pm

Re: getting info from HTTP line

Post 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 :D

Thank you
Post Reply