FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » php url question
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
php url question [message #180562] Tue, 26 February 2013 17:28 Go to next message
Kevin Davis is currently offline  Kevin Davis
Messages: 5
Registered: May 2012
Karma: 0
Junior Member
Hi there,

I have a simple question with PHP URL's setup.. Here is the situation I have a page that is based on the urls.. For example, I have a php file that will display based on the following sample url: http://temp.com/t2, however in some cases the url could be http://temp.com/t2?d=temp or something similar. That type of url tend screw up the settings. Is there a way for me to drop the d=temp so the page settings will not get messed up when the url's is read in.

Thank you.
Re: php url question [message #180563 is a reply to message #180562] Tue, 26 February 2013 17:42 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 26.02.2013 18:28, schrieb Kevin Davis:
> Hi there,
>
> I have a simple question with PHP URL's setup.. Here is the situation I have a page that is based on the urls.. For example, I have a php file that will display based on the following sample url: http://temp.com/t2, however in some cases the url could be http://temp.com/t2?d=temp or something similar. That type of url tend screw up the settings. Is there a way for me to drop the d=temp so the page settings will not get messed up when the url's is read in.
>

Your Url http://temp.com/t2 would not work in the first place, because the web
server has to recognize PHP scripts so he/she can hand them to the PHP interpreter.

This is normally done by the suffix .php for script files. If you have a special
setup with scipt aliases you have to talk about it.

Independent from this is the fact that url encoded variables like d=temp would not
screw anything up, especially not settings.

/Str.
Re: php url question [message #180565 is a reply to message #180562] Tue, 26 February 2013 17:45 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/26/2013 12:28 PM, Kevin Davis wrote:
> Hi there,
>
> I have a simple question with PHP URL's setup.. Here is the situation I have a page that is based on the urls.. For example, I have a php file that will display based on the following sample url: http://temp.com/t2, however in some cases the url could be http://temp.com/t2?d=temp or something similar. That type of url tend screw up the settings. Is there a way for me to drop the d=temp so the page settings will not get messed up when the url's is read in.
>
> Thank you.
>

What have you tried?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: php url question [message #180566 is a reply to message #180565] Tue, 26 February 2013 19:41 Go to previous messageGo to next message
Kevin Davis is currently offline  Kevin Davis
Messages: 5
Registered: May 2012
Karma: 0
Junior Member
On Tuesday, February 26, 2013 11:45:47 AM UTC-6, Jerry Stuckle wrote:
> On 2/26/2013 12:28 PM, Kevin Davis wrote:
>
>> Hi there,
>
>>
>
>> I have a simple question with PHP URL's setup.. Here is the situation I have a page that is based on the urls.. For example, I have a php file that will display based on the following sample url: http://temp.com/t2, however in some cases the url could be http://temp.com/t2?d=temp or something similar. That type of url tend screw up the settings. Is there a way for me to drop the d=temp so the page settings will not get messed up when the url's is read in.
>
>>
>
>> Thank you.
>
>>
>
>
>
> What have you tried?
>
>
>
> --
>
> ==================
>
> Remove the "x" from my email address
>
> Jerry Stuckle
>
> JDS Computer Training Corp.
>
> jstucklex(at)attglobal(dot)net
>
> ==================

One option that I'm trying is $_SERVER['PATH_INFO'] instead of $_SERVER['REQUEST_URI']
Re: php url question [message #180567 is a reply to message #180566] Tue, 26 February 2013 20:30 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 26.02.2013 20:41, schrieb Kevin Davis:
> On Tuesday, February 26, 2013 11:45:47 AM UTC-6, Jerry Stuckle wrote:
>> On 2/26/2013 12:28 PM, Kevin Davis wrote:
>>
>>
>>> I have a simple question with PHP URL's setup.. Here is the situation I have a page that is based on the urls.. For example, I have a php file that will display based on the following sample url: http://temp.com/t2, however in some cases the url could be http://temp.com/t2?d=temp or something similar. That type of url tend screw up the settings. Is there a way for me to drop the d=temp so the page settings will not get messed up when the url's is read in.
>>
>>
>> What have you tried?
>>
>
> One option that I'm trying is $_SERVER['PATH_INFO'] instead of $_SERVER['REQUEST_URI']
>

Just put into your script:

var_dump($_SERVER);

and see what the variables contain.

/Str.
Re: php url question [message #180568 is a reply to message #180566] Tue, 26 February 2013 20:41 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/26/2013 2:41 PM, Kevin Davis wrote:
> On Tuesday, February 26, 2013 11:45:47 AM UTC-6, Jerry Stuckle wrote:
>> On 2/26/2013 12:28 PM, Kevin Davis wrote:
>>
>>> Hi there,
>>
>>>
>>
>>> I have a simple question with PHP URL's setup.. Here is the situation I have a page that is based on the urls.. For example, I have a php file that will display based on the following sample url: http://temp.com/t2, however in some cases the url could be http://temp.com/t2?d=temp or something similar. That type of url tend screw up the settings. Is there a way for me to drop the d=temp so the page settings will not get messed up when the url's is read in.
>>
>>>
>>
>>> Thank you.
>>
>>>
>>
>>
>>
>> What have you tried?
>>
>>
>>
>
> One option that I'm trying is $_SERVER['PATH_INFO'] instead of $_SERVER['REQUEST_URI']
>

OK, that will get you the 't2', if that's what you want. A longer way
would be to explode it on the '?'.

$array = explode('?', $_SERVER['REQUEST_URI']);

$array[0] will contain the request. If there are parameters, they will
be in $array[0] (and you could explode that also, but it's all in the
$_GET superglobal anyway).

Is this a case where you're using .htaccess to redirect pages (i.e. in a
CMS)? I'm wondering, because normally scripts know how they were called
(based on the filename). About the only place I've needed such is for
an intelligent error processing page (i.e. 404 Not Found message).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: php url question [message #180572 is a reply to message #180562] Tue, 26 February 2013 22:23 Go to previous message
Olaf S. is currently offline  Olaf S.
Messages: 10
Registered: December 2011
Karma: 0
Junior Member
Am 26.02.2013 18:28, schrieb Kevin Davis:
> Hi there,
>
> I have a simple question with PHP URL's setup.. Here is the situation I have a page that is based on the urls.. For example, I have a php file that will display based on the following sample url: http://temp.com/t2, however in some cases the url could be http://temp.com/t2?d=temp or something similar. That type of url tend screw up the settings. Is there a way for me to drop the d=temp so the page settings will not get messed up when the url's is read in.
>
> Thank you.
>

$org_url = "http://temp.com/t2";
$url_array = explode("?", $org_url);
echo $url_array[0];
// Prints: http://temp.com/t2


$org_url = "http://temp.com/t2?d=temp";
$url_array = explode("?", $org_url);
echo $url_array[0];
// Also prints: http://temp.com/t2
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: simpletest vs phpunit vs ...
Next Topic: Request for proofreading
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 16:40:16 GMT 2024

Total time taken to generate the page: 0.02519 seconds