0

Is it possible to get all parameters from a URL? For example, in https://e-consultaruc.sunat.gob.pe/cl-ti-itmrconsruc/frameCriterioBusqueda.jsp

Is it possible to retrieve all the parameters in the URL address that sends to the server (the query) when I enter all the required information and press "Search" (buscar) button?

Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54
  • How is the query being sent. Is it a regular `
    `?
    – seebiscuit Aug 22 '18 at 01:47
  • I think its a javascript query that sends to the server, but i want to know the structure of it, so i can type it directly in the URL instead of filling these forms – Alberto Kuan Aug 22 '18 at 01:48
  • 1
    There are no query params in the URL you posted. However, if you check DevTools and click on the URL there may be a payload being sent over (that is, data that is attached to the request, but not listed on the URL. If that is the case, there is no way for you to type the URL yourself. – seebiscuit Aug 22 '18 at 01:54
  • Sorry, this is the correct one> https://e-consultaruc.sunat.gob.pe/cl-ti-itmrconsruc/jcrS00Alias – Alberto Kuan Aug 22 '18 at 01:58
  • In the URL you've just given us, how would you know what is a route parameter and what is just part of a route? I mean, okay, `e-consultaruc.sunat.gob.pe` is clearly an address, but `cl-ti-itmrconsruc` might be a parameter, or it might not. Is the webpage with the Search button yours? If not, I'm not sure this question has an answer. – Andy Taton Aug 22 '18 at 02:13
  • 2
    Query parameters are at the end of the url, and begin with `?` and usually have the structure of `key=value` with the optional spacer `&` between values. You url still does not have query params – seebiscuit Aug 22 '18 at 02:13
  • Wrt what @AndyTaton mentioned, it's true, routing parameters could be found after the domain name, and are generally between `/`. Again, check the DevTools (Chrome's are probably the best) for that request. – seebiscuit Aug 22 '18 at 02:14
  • While the question I've linked is not a duplicate, it does demonstrate why it may not be as simple as adding the key/value pairs to the URL. [Parameters as POST](https://stackoverflow.com/questions/611906/http-post-with-url-query-parameters-good-idea-or-not) shows that parameters can be sent in the body of the request as a POST. That said, some servers may not care whether parameters are sent as url key/value pairs or as "POST payload", in which case once you've analyzed the POST body of a request you're OK. I just wouldn't want to guarantee this will work everywhere. – dgnuff Aug 22 '18 at 02:39

2 Answers2

0

I'm not sure what you want to accomplish. Not enough information in your question. But I assuming you only want to get all parts of a given URL.

If so, you can easily use php for that, for instance to extract the last part of a URL :

<?php

$string = 'https://e-consultaruc.sunat.gob.pe/cl-titmrconsruc/frameCriterioBusqueda.jsp';

$part = substr(strstr($string, '/'), 1);
Drunken M
  • 2,013
  • 2
  • 11
  • 18
0

I wanna know all the parameters possible for that form