|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of Crawler Detect - the web crawler detection library. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Mark Beech <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Jaybizzle\CrawlerDetect\Fixtures; |
|
13
|
|
|
|
|
14
|
|
|
class Headers extends AbstractProvider |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* All possible HTTP headers that represent the user agent string. |
|
18
|
|
|
* |
|
19
|
|
|
* @var array |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $data = array( |
|
22
|
|
|
// The default User-Agent string. |
|
23
|
|
|
'HTTP_USER_AGENT', |
|
24
|
|
|
// Header can occur on devices using Opera Mini. |
|
25
|
|
|
'HTTP_X_OPERAMINI_PHONE_UA', |
|
26
|
|
|
// Vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/ |
|
27
|
|
|
'HTTP_X_DEVICE_USER_AGENT', |
|
28
|
|
|
'HTTP_X_ORIGINAL_USER_AGENT', |
|
29
|
|
|
'HTTP_X_SKYFIRE_PHONE', |
|
30
|
|
|
'HTTP_X_BOLT_PHONE_UA', |
|
31
|
|
|
'HTTP_DEVICE_STOCK_UA', |
|
32
|
|
|
'HTTP_X_UCBROWSER_DEVICE_UA', |
|
33
|
|
|
// Sometimes, bots (especially Google) use a genuine user agent, but fill this header in with their email address |
|
34
|
|
|
'HTTP_FROM', |
|
35
|
|
|
'HTTP_X_SCANNER', // Seen in use by Netsparker |
|
36
|
|
|
'HTTP_X_PURPOSE', // Prefetch Header |
|
37
|
|
|
'HTTP_PURPOSE', // Prefetch Header |
|
38
|
|
|
); |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Headers used for prefetching webpages by different services |
|
42
|
|
|
* |
|
43
|
|
|
* @var array |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $prefetchHeaders = array( |
|
46
|
|
|
'HTTP_X_PURPOSE' => 'preview', // Used by Facebook to prefetch, as well the previews seen when opening a new tab in Chrome and Safari |
|
47
|
|
|
'HTTP_PURPOSE' => 'prefetch', // Seen with value prefetch |
|
48
|
|
|
); |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Return the data set. |
|
52
|
|
|
* |
|
53
|
|
|
* @return array |
|
54
|
|
|
*/ |
|
55
|
|
|
public function getPrefetchHeaders() |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->prefetchHeaders; |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|