how to get full url with # in laravel - laravel

I am using laravel 5 and I am trying to get my full url which is
/faq#manual
However I can only get /faq
when I call the function
Request::url() or Request::fullUrl()
is there any way I can get the full url
with #manual?

It is impossible to get the fragment from a URL with Standard HTTP. So using variables like $_SERVER or $_GET can't help you. Actually, the server never knows about this value because the browser won't even send a request with a fragment part.
If you want to have the fragment value in the server side, you should get the value by javascript first then pass it as a URL parameter and get it by $_GET in your server side.

That's not possible in http or php however you can use javascript to get the full url including the hash.
var url = document.URL;
or
var url = window.location.href;
Hope this helps.

Related

NET Core application WebMethod needs to pass in URL as parameter

My NET Core application exposes a Webmethod.
This method needs to accept a URL as parameter for further processing.
e.g.
mysite.com/webmethod/url=https://www.google.com
It would never go through.
Instead, it shows Page Not Found.
It seems this webmethod will never be routed to my controller if there is a forward slash in the URL.
However, after getting rid of forward slash, it works very well.
mysite.com/webmethod/url=https:www.google.com
Could someone tell me how to deal with forward slash?
Thank you.
You can use UrlEncode and UrlDecode.
var queryString = UrlEncode("https://google.com"); // https%3A%2F%2Fgoogle.com
var decodedString = UrlDecoce(queryString); // https://google.com

CodeIgniter URL Encryption

All Viewers I am New in Codeigniter, I need your guide to done my work, I want to Encrypted full URL like below example.
For example this is my url www.example.com & my controller is home, so full url is www.example.com/home
now I want to encrypted all controller, function like below
www.example.com/5115784bef2514430e7f74d9a71d4142a942efb0f7cc428626bda7633326f9d015fbacc60d93cd6b858f9b6e05c1e56263acb24297cecc720467eb4f222d81e5hdn5B
I can encrypted & decrypted the text well, but I just don't get how can I decrypted from url & make understand which controller or function its called, I want to decrypted everything after base_url.
please don't suggest me about using common controller, because I already know that & anyhow common controller its hide everything so its not required the encryption as I believe.
Waiting for your positive response, hopefully my problem will be solve soon. T.I.A
Well i never encrypt any URL before but you can use a php function url_encode
And "str_replace" function.
the reason for using "str_replace" beacause url_encode only encode special character in URL.
Hope I help some.
Try the code below.
urlencode(str_replace("your_domain.com/YourCOntrollerName/YourMethodName" , "SM5ah52" , yor_domain.com . "YourCOntrollerName/YourMethodName/YOuData"));
If not this. There is an library in CI Framework called Encryption.
You can get help from there Encryption.
Go with URI Routing and define one controller to decode whatever you are passing, and call proper controller / method from it.
You can use URI Routing with regular expressions.
$route["other_controllers/method"] = "other_controllers/method"; //you can add this kind of lines to not to affect other controllers
$route["([a-zA-Z0-9]+)"] = "home/decrypt/$1";
In the home controller, You can
Redirect to the page
Or
Load a view
public function decrypt($token){
//geting the page according to the token from database.
$desired_page = $this->some_model->get_page($token);
//if you want to redirect
redirect($desired_page);
//if you want to load a view
$this->load->view($desired_page);
}

How can I get URL information following "#" in Koa

I have a URL that in the browser shows like this https://localhost:3000/location#valueIwant=1234.
I am trying to get access to the valueIwant value but all of the items I try ctx.request.path, ctx.request.href, etc but all seem to not have the values after #. How do I parse this part of the url.
Also this is coming from a redirect.
Everything after the # is not sent to the server. The purpose of the fragment is to create a link to a specific subsection of a page.
If you want to send specific parameters to the server, the right way to do it is to use the query part (everything after ?), not the fragment part. This is by design.

Laravel How to get Url

When trying to get page url with
URL::current();
it's ignore the pagination.
For example:
current url is www.google.com/searc?page=2
dd(URL::current());
gives us www.google.com/search. Using default pagination.
My question is: Any function for get url with paginations?
Simply use :
\URL::full();
It will give the url along with query string.
You will need the full URL, not just the URL. Try this:
\URL::full();
As described in the docs of Laraval. You can use URL::full()
Accessing The Current URL
If no path is provided to the url helper, a
Illuminate\Routing\UrlGenerator instance is returned, allowing you to
access information about the current URL:
// Get the current URL without the query string...
echo url()->current();
// Get the current URL including the query string...
echo url()->full();
// Get the full URL for the previous request...
echo url()->previous();
Each of these methods may also be accessed via the URL facade:
use Illuminate\Support\Facades\URL;
echo URL::current();

How to hide function and parameter from url in codeigniter?

this is my URL.
http://localhost/savyy/home/home_page/Islamabad
i want to show it like
http://localhost/savyy/home
i m using uri routing code
$route['home/(:any)'] = 'home/home_page/$1;
but nothings happen...it shows same URL. can anyone please help me ? please tell me how to hide function name and parameter.
I dont think it will work that way, the request is the route to controller. the request uri will be the same. you will still have the "home/home_page/islamabad" in your url. unless you redirect with the home_page() to home() and save the islamabad in a session.

Resources