Get Original Url Referer With PHP

Get original URL referer with PHP?

Store it either in a cookie (if it's acceptable for your situation), or in a session variable.

session_start();

if ( !isset( $_SESSION["origURL"] ) )
$_SESSION["origURL"] = $_SERVER["HTTP_REFERER"];

Get original URL referer with the condition

I found my problem. Maybe this solution will help anyone in the future.

function getRefererPage3( $form_tag ){  
if (strpos($_SESSION['LandingPage'], 'partner') !== false) {
if ( $form_tag['name'] == 'referer-page3 ) {
$form_tag['values'][] = $_SESSION['LandingPage'];
}
}
return $form_tag;
}
if ( !is_admin() ) {
add_filter( 'wpcf7_form_tag', 'getRefererPage3' );
}

PHP: How to get referrer URL?

$_SERVER['HTTP_REFERER'] will give you the referrer page's URL if there exists any. If users use a bookmark or directly visit your site by manually typing in the URL, http_referer will be empty. Also if the users are posting to your page programatically (CURL) then they're not obliged to set the http_referer as well. You're missing all _, is that a typo?

Get Original Referrer URL from Google Search with PHP?

Google removes the search query for HTTPS connections and logged users so the only way to know the search query is using Google Analytics

When you search from https://www.google.com, websites you visit from our organic search listings will still know that you came from Google, but won't receive information about each individual query.

http://googleblog.blogspot.com.es/2011/10/making-search-more-secure.html
http://analytics.blogspot.com.es/2011/10/making-search-more-secure-accessing.html

Get the action name of referer url (previous url) in cakephp

To get the referer full base url, we use $this->referer(), if you parse Router::parse($this->referer()); we get an empty array

but to restrict referring urls to local server, you've to use pass additional param like below

$refer_url = $this->referer('/', true); // you get like "/project/users/login"

Now if you parse the above returned value
$parse_url_params = Router::parse($refer_url);

you'll get the details of Controller, Action & Plugin

Here are the details:

Array ( 
[plugin] =>
[controller] => users
[action] => login
[named] => Array ()
[pass] => Array ( )
)


Related Topics



Leave a reply



Submit