0

In PHP it's $_SERVER['HTTP_REFERER'] and JS document.referrer but they only show the domain the visitor come from like example.com

Is there a way to find out the full url like exampe.com/?cat=bla&something=yey

I think it's not possible but I don't know for sure. Or is it possible in any other languages like ruby/python and so on?

user229044
  • 232,980
  • 40
  • 330
  • 338
  • 1
    This has nothing to do with the choice of language. Different languages don't give you different levels of access to HTTP headers. – user229044 Jan 25 '18 at 05:16
  • If it is possible in one language, then it is possible in all languages, even in English and Arabic :p – baig772 Jan 25 '18 at 05:20
  • Ok so it means it's not possible? Also no matter what OS the server run on? –  Jan 25 '18 at 05:24
  • I need to know it so I don't get questions from advertisers like "why do you send these visitors from this specific url on your website" etc. :D So I hope it's not possible :D –  Jan 25 '18 at 05:26
  • $_SERVER['HTTP_REFERER'] should not only show a domain –  Jan 25 '18 at 05:29
  • @rtfm but it do? I tried echo and also var_dump. Do you have other suggestions? –  Jan 25 '18 at 05:32
  • server? os? hosting? –  Jan 25 '18 at 05:34
  • I don't know the operatting systems of the servers of all the advertisers/affiliate programs xD –  Jan 25 '18 at 05:39
  • 1
    It doesn't matter the language or OS and anything else. The referrer is not reliable. Sometimes it gives you the full URL with the query string (rarely), sometimes it only gives you the domain, sometimes it is blank, and sometimes it is a fake URL. It all depends on the webserver, security suites, and proxies. It is under their control and they decide what to send you. Check [Referer hiding on Wikipedia](https://en.wikipedia.org/wiki/HTTP_referer). – Racil Hilan Jan 25 '18 at 05:43
  • i dont understand how the code is hosted –  Jan 25 '18 at 05:45
  • So I can be sure that at least the VAST MAJORITY or the people I send to the advertisors don't "give" them the full url of the website they come from? –  Jan 25 '18 at 05:50
  • Look at these - might help - https://stackoverflow.com/questions/6768793/get-the-full-url-in-php , https://codeupweb.wordpress.com/2017/10/11/how-to-get-the-full-url-of-page-using-php/ – T.Shah Jan 25 '18 at 06:04
  • Use of HTTPS (or not) can also play a part in what (if any) referrer information is sent. It's a privacy thing. In short you can't rely on it for anything, you can't be sure of anything, and I wouldn't be trying to sell anything to advertisers based on it (or at least not without a lot of caveats about data quality) – ADyson Jul 28 '19 at 08:23

1 Answers1

0

Using PHP you can get full URL including query string. The code below will print the full URL and separate the query string (if exist). You only need to test it by typing the query string (http://www.url.org?q=query)

<?PHP
    $url= $_SERVER['HTTP_REFERER'];
    echo $url;
    parse_str(parse_url(trim($url))['query'], $qs); 
    $qs=http_build_query($qs);
    echo $qs;
?>
Kardi Teknomo
  • 1,375
  • 16
  • 24
  • In theory yes, but the point is that what is contained in the referrer header is not under your control, so it may not always actually contain those values (or even any values at all) – ADyson Jul 28 '19 at 08:20