How to pass # in url params? [duplicate] - php

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
# in url getting ignored in php 5.2
I have following link on webpage. Here I am sending return(/profile?id=6#contacts) as url param to return back after operation complete. But it is sending only /profile?id=6 to verify.php script.
http://example.com/verify.php?id=1&sessionId=6&return=/profile.php?id=6#contacts
I know that hash value is not passed to server but I want to know that is there any way to pass compelete return param to server with # value.
Thanks

You need to urlencode() the entire return parameter.

Related

How can I get URL (with some parameters)? [duplicate]

This question already has answers here:
Get URL query string parameters
(11 answers)
Closed 6 years ago.
I have a form on page, with url like this:
site.com/form.index.html?ref=https://login....
And I get page URL via this code:
http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]
But as result I get not full URL, just this:
site.com/form.index.html
How can I get full URL?
You want to add the query string:
$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]$_SERVER[QUERY_STRING]";
Additionally, you may replace the http bit with $_SERVER[REQUEST_SCHEME]:
"$_SERVER[REQUEST_SCHEME]://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]$_SERVER[QUERY_STRING]"

What to parameter value from returning url in php [duplicate]

This question already has answers here:
GET URL parameter in PHP
(7 answers)
Closed 7 years ago.
I have a client url[www.mysite.com/page.aspx]
when we put this url in browser then it revert the automatically
with this url
[www.mysite.com/page.aspx?|&CC=121&DD=123&AA=323|&CC=321&DD=555&AA=000]
Now we want to fetch that parameter value in php page through php or jquery.
Kindly Help and give the best suggestions.
You can simply use GET
$cc = $_GET['CC'];
$dd = $_GET['DD'];
You can access those values using $_REQUEST or $_GET

PHP get URL content [duplicate]

This question already has answers here:
Can I read the hash portion of the URL on my server-side application (PHP, Ruby, Python, etc.)?
(12 answers)
Closed 9 years ago.
I have a URL
http://localhost/ifocus/v3/services.php#nav-section2
I want to get hashtags from URL, EX : if the URL contains "#" so capture it via PHP
nav-section2
When i do
echo $_SERVER['REQUEST_URI'];
// Output
/ifocus/v3/services.php
You can't detect the hash parameter of the URL in PHP, you would need to use JavaScript.
You could make a jquery call to php which passes the hash data (window.location.hash) to a PHP script as a URL parameter and return TRUE/FALSE though.
You can not capture this content for that you need js(client side script)

How can get the current path in PHP [duplicate]

This question already has answers here:
How to get URL of current page in PHP [duplicate]
(5 answers)
Closed 9 years ago.
How can I return the path of the current page including whats after ?
So for example I am this link
localhost/site1/index.php?view=10&user=5
I want to return this value "index.php?view=10&user=5"
How can I do that using PHP?
I thought $_SERVER['SCRIPT_NAME'] do this but SCRIPT_NAME is returing index.php
$_SERVER['QUERY_STRING']
and
$_SERVER['REQUEST_URI']
request uri will give you full uri, you can manipulate it to get the last path
as #Mathieu Imbert said, get curious. Inspect everything $_SERVER gives you either by var_dump or by reading documentation i linked to in a comment

How to rewrite URL with hash in it? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Can PHP read the hash portion of the URL?
I use hash in my url like this,
http://mysite.com/home/#/page/manage/
I want to get /page/manage/ via $_REQUEST so I try url rewrite mod like this below,
RewriteRule ^home/#/([a-zA-Z0-9\-]+)/([a-zA-Z0-9\-]+)/?$ index.php?url=home&system_url=$1&system_name=$2 [L,QSA]
system_url=$1&system_name=$2 are not sent to $_REQUEST of course.
How can I get the result below via $_REQUEST?
array([url]=>'home',[system_url] => 'page',[system_name] => 'manage')
The fragment part of a URL (the part after #) is not actually sent to the webserver.
Thus, it is not possible to use rewrite to change it

Categories