PHP: How to get referrer URL? -
i have page (only index) customers can send me emails , want see website visitor coming from?
how can referrer url
php? tried $_server['http_referer']
it's empty time. how can this? thank you!
here $_server
contains ("---- censored ----" censored me)
array(31) { ["document_root"]=> string(33) "/home/anything/public_html/design" ["gateway_interface"]=> string(7) "cgi/1.1" ["http_accept"]=> string(129) "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1" ["http_accept_encoding"]=> string(13) "gzip, deflate" ["http_accept_language"]=> string(14) "en-us,en;q=0.9" ["http_cache_control"]=> string(8) "no-cache" ["http_connection"]=> string(10) "keep-alive" ["http_cookie"]=> string(189) "__utma=76630272.1468291432.1367655794.1367669576.1367674157.3; __utmb=76630272.1.10.1367674157; __utmc=76630272; __utmz=76630272.1367655794.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)" ["http_host"]=> string(25) " ---- censored ---- " ["http_user_agent"]=> string(57) "opera/9.80 (windows nt 6.1) presto/2.12.388 version/12.15" ["path"]=> string(13) "/bin:/usr/bin" ["query_string"]=> string(0) "" ["redirect_status"]=> string(3) "200" ["remote_addr"]=> string(10) "5.15.68.79" ["remote_port"]=> string(5) "57897" ["request_method"]=> string(3) "get" ["request_uri"]=> string(12) "/referer.php" ["script_filename"]=> string(45) "/home/anything/public_html/design/referer.php" ["script_name"]=> string(12) "/referer.php" ["server_addr"]=> string(13) " ---- censored ---- " ["server_admin"]=> string(35) " ---- censored ---- " ["server_name"]=> string(25) " ---- censored ---- " ["server_port"]=> string(2) "80" ["server_protocol"]=> string(8) "http/1.1" ["server_signature"]=> string(189) " apache/2.2.19 (unix) mod_ssl/2.2.19 openssl/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 frontpage/5.0.2.2635 server @ ---- censored ---- port 80 " ["server_software"]=> string(125) "apache/2.2.19 (unix) mod_ssl/2.2.19 openssl/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 frontpage/5.0.2.2635" ["unique_id"]=> string(24) "uyuncupeidsaabkr2eyaaaaj" ["php_self"]=> string(12) "/referer.php" ["request_time"]=> int(1367674225) ["argv"]=> array(0) { } ["argc"]=> int(0) }
$_server['http_referer']
give referrer page's url if there exists any. if users use bookmark or directly visit site manually typing in url, http_referer empty. if users posting page programatically (curl) they're not obliged set http_referer well. you're missing _
, typo?
Comments
Post a Comment