Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Devuelve el Referer limpio

// Limpia y devuelve el REFERER

	function getReferer(){
		// limpia el referer 
		$ref = $_SERVER['HTTP_REFERER'];
		$web = str_replace(array('http://','www.'),'',$ref);
		$web = substr($web,0,strpos ($web, '/'));
		if(!empty($web)):
			// retorna el referer limpio
			return $web;
		else:
			// sin referer
			return 'jane.es';
		endif;
	}

using wget to download content protected by referer and cookies

1. get base url and save its cookies in file
2. get protected content using stored cookies

 $ wget --cookies=on --keep-session-cookies --save-cookies=cookie.txt http://first_page
 $ wget --referer=http://first_page --cookies=on --load-cookies=cookie.txt --keep-session-cookies --save-cookies=cookie.txt http://second_page
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS