TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   $_GET and spaces (http://www.talkphp.com/general/2864-_get-spaces.html)

h0ly lag 05-30-2008 06:23 PM

$_GET and spaces
 
So I have coded a nice little Halo 3 stats sig but I'm having troubles with it getting the stats of gamertags with spaces in them.

This works:
http://lagnet.org/stats/Shishka.png

This doesn't:
http://lagnet.org/stats/TJ Scoot.png

I've Googled around for a little bit, but to no avail. Oh and adding %20 doesn't do a damn thing either.

delayedinsanity 05-30-2008 06:28 PM

I'm not sure what your code is doing, just what it's outputting, but I would suggest substituting spaces for something such as underscores, and using str_replace or your tool of choice to swap them in and out as needed.
-m

sketchMedia 05-30-2008 06:31 PM

how does your code grab data for the tag? whats the site url.

pardon my ignorance in this, i have little to no clue about gamertags

h0ly lag 05-30-2008 06:33 PM

Mmk, would this work?

$gt = str_replace(" ","-",$_GET['gt']);

EDIT:
I also forgot to mention I'm using mod_rewrite and that the actual URL is
/stats/stats.php?gt=Gamertaghere

@sketchMedia
I posted working links in my post.

EDIT2:
Thanks delayedinsanity, str_replace worked perfect. I ended up using this:
$gt = str_replace(" ","+",$_GET['gt']);

sketchMedia 05-30-2008 06:45 PM

my question remains unanswered, how did you get the DATA for the image? i dont want to see the end result, i was assuming that you either screen scraped or found an api from microsoft to grab the data thus my initial thought that it could be a problem in how you were requesting data from that web service.

edit: sorry if that sounds obnoxious, but i have a headache and tend to behave like a bear with a sore head xD

h0ly lag 05-30-2008 07:22 PM

I am scraping the data from Bungies website.

Folio 05-30-2008 08:26 PM

urlencode() may help you here for decoding what is passed in the url or what you are adding to the url
did you try replacing the spaces with '&nbsp'?

h0ly lag 05-30-2008 08:30 PM

It's already working.


All times are GMT. The time now is 02:23 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0