php url get

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
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

php url get

Post by Vegan »

rather than something like:

http://www.mydomain.me/index.php?state= ... p#Berkeley

You can treat the named anchor as a query string like this:

http://www.mydomain.me/index.php?state= ... y=Berkeley

Then, access it like this:

Code: Select all

$Url = $_GET['state']."#".$_GET['city'];
so given those two containers are known, this probably the best wey to leverage PHP URLs

so that content can be assembled before its returned via ECHO

Code: Select all

<?php
if (isset($_GET['link'])) {
    echo $_GET['link'];
}else{
    // Fallback behaviour goes here
}
but i think some parser should be used to make sure city and state are valid etc
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: php url get

Post by requinix »

Okay?
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: php url get

Post by Vegan »

I was thinking of using this kind of strategy to grab ads from an ad manager

consider i may know the country so GET the suitable ad for the user

I can often locate even better so may down the road more detailed resolution ads
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: php url get

Post by requinix »

Okay... All that's happened so far is you've described how query strings work.
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: php url get

Post by Vegan »

given a query string, i was thinking, i can use SWITCH state or SWITCH city, right now I am more focused on the sovereign for ecommerce

at the most basic, i could a crude index for SWITCH choice and then for the cases pic the ad i want to use

given a query based url, makes it slightly easier to use localized ads etc

but i can also sniff out location without get

but the idea of an ad server seems like it has some potential
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
Post Reply