Click here to Skip to main content
16,007,885 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
GeneralRe: Suggestions on format - XML, JSON, XXX... Pin
Mohibur Rashid3-Feb-12 22:43
professionalMohibur Rashid3-Feb-12 22:43 
QuestionHandling HTTP Errors Pin
awedaonline26-Jan-12 2:48
awedaonline26-Jan-12 2:48 
AnswerRe: Handling HTTP Errors Pin
Graham Breach26-Jan-12 3:41
Graham Breach26-Jan-12 3:41 
Questionchange address link Pin
Member 790448226-Jan-12 0:38
Member 790448226-Jan-12 0:38 
QuestionHow can i add simple texteditor to my application Pin
DeepthiTanguturi25-Jan-12 22:17
DeepthiTanguturi25-Jan-12 22:17 
AnswerRe: How can i add simple texteditor to my application Pin
thatraja26-Jan-12 0:25
professionalthatraja26-Jan-12 0:25 
QuestionI want to clear something about PHP and HTML (newbie) Pin
flashery23-Jan-12 20:46
flashery23-Jan-12 20:46 
AnswerRe: I want to clear something about PHP and HTML (newbie) Pin
Graham Breach23-Jan-12 22:32
Graham Breach23-Jan-12 22:32 
GeneralRe: I want to clear something about PHP and HTML (newbie) Pin
flashery23-Jan-12 22:37
flashery23-Jan-12 22:37 
GeneralRe: I want to clear something about PHP and HTML (newbie) Pin
Jon Heather25-Jan-12 9:40
Jon Heather25-Jan-12 9:40 
AnswerRe: I want to clear something about PHP and HTML (newbie) Pin
markkuk24-Jan-12 0:52
markkuk24-Jan-12 0:52 
GeneralRe: I want to clear something about PHP and HTML (newbie) Pin
flashery24-Jan-12 1:11
flashery24-Jan-12 1:11 
AnswerRe: I want to clear something about PHP and HTML (newbie) Pin
Necron81-Feb-12 5:18
Necron81-Feb-12 5:18 
Question2 outta 3 ain't bad....but why is ftp_put() failing...? Pin
cjoki23-Jan-12 10:30
cjoki23-Jan-12 10:30 
AnswerRe: 2 outta 3 ain't bad....but why is ftp_put() failing...? Pin
User 171649223-Jan-12 11:50
professionalUser 171649223-Jan-12 11:50 
GeneralRe: 2 outta 3 ain't bad....but why is ftp_put() failing...? Pin
cjoki27-Jan-12 4:51
cjoki27-Jan-12 4:51 
QuestionA form data with cascading dropdown and photo for upload Pin
awedaonline23-Jan-12 4:03
awedaonline23-Jan-12 4:03 
AnswerRe: A form data with cascading dropdown and photo for upload Pin
Mohibur Rashid24-Jan-12 22:34
professionalMohibur Rashid24-Jan-12 22:34 
GeneralRe: A form data with cascading dropdown and photo for upload Pin
awedaonline25-Jan-12 21:43
awedaonline25-Jan-12 21:43 
QuestionPHP & JavaScript integration Pin
MacRaider423-Jan-12 1:53
MacRaider423-Jan-12 1:53 
AnswerRe: PHP & JavaScript integration Pin
Graham Breach23-Jan-12 2:37
Graham Breach23-Jan-12 2:37 
GeneralRe: PHP & JavaScript integration Pin
MacRaider423-Jan-12 2:49
MacRaider423-Jan-12 2:49 
GeneralRe: PHP & JavaScript integration Pin
Graham Breach23-Jan-12 3:55
Graham Breach23-Jan-12 3:55 
GeneralRe: PHP & JavaScript integration Pin
MacRaider423-Jan-12 4:45
MacRaider423-Jan-12 4:45 
QuestionGetting the URL Minus the Query String Pin
Kevin Li (Li, Ken-un)22-Jan-12 17:49
Kevin Li (Li, Ken-un)22-Jan-12 17:49 
At the moment, I have index.php located at the root. I want to have it parse all my URLs and delegate the workload to the correct code (via URL rewriting). I may be a bit nit-picky, but I'd like to know if there's an elegant solution to neatly separating the request URL and the key-value pairs of the query?

My index.php looks like this:
PHP
<?php
	// Set the content type of the output.
	header('Content-Type: text/plain; charset=utf-8');
	
	// Get and handle the request string.
	echo 'Debug Output';
	echo "\n\n";
	echo 'Request ($_SERVER["REQUEST_URI"]): "'.$_SERVER['REQUEST_URI'].'"';
	echo "\n";
	echo 'Request ($_GET["request"]): "'.$_GET['request'].'"';
	echo "\n";
	echo 'd="'.$_GET['d'].'"';
	echo "\n";
	echo 'e="'.$_GET['e'].'"';
	echo "\n";
?>


If I give it some URLs, they produce the corresponding outputs:

  1. mysite.com/a/b/c?d=1&e=2&request=3
    Debug Output
    
    Request ($_SERVER["REQUEST_URI"]): "/a/b/c?d=1&e=2&request=3"
    Request ($_GET["request"]): "3"
    d="1"
    e="2"
  2. mysite.com/a/b/c?d=3&e=4
    Debug Output
    
    Request ($_SERVER["REQUEST_URI"]): "/a/b/c?d=3&e=4"
    Request ($_GET["request"]): "a/b/c"
    d="3"
    e="4"


$_SERVER["REQUEST_URI"] includes everything after mysite.com including the raw query string, and $_GET["request"] will not return the requested URL minus the query string if there is a key named request.

I could parse the value of $_SERVER["REQUEST_URI"] myself, but I'd like to use built-in functionality before coding around the problem.


My GUID: ca2262a7-0026-4830-a0b3-fe5d66c4eb1d Smile | :)

Now I can Google this value and find all my Code Project posts!

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.