1 | <?php |
||
15 | class Browser |
||
16 | { |
||
17 | /** |
||
18 | * Default HTTP User-Agent. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | const DEFAULT_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36'; |
||
23 | |||
24 | /** |
||
25 | * Browser. |
||
26 | * |
||
27 | * @var \Guzzle\Http\Client |
||
28 | */ |
||
29 | protected $browser; |
||
30 | |||
31 | /** |
||
32 | * Request. |
||
33 | * |
||
34 | * @var \Symfony\Component\HttpFoundation\Request |
||
35 | */ |
||
36 | protected $request; |
||
37 | |||
38 | /** |
||
39 | * HTTP host. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $host; |
||
44 | |||
45 | /** |
||
46 | * Browser timeout. |
||
47 | * |
||
48 | * @var int |
||
49 | */ |
||
50 | protected $timeout; |
||
51 | |||
52 | /** |
||
53 | * Browser proxy list. |
||
54 | * |
||
55 | * @var array |
||
56 | */ |
||
57 | protected $proxy_list; |
||
58 | |||
59 | /** |
||
60 | * Construct. |
||
61 | * |
||
62 | * @param string $host |
||
63 | * @param int $timeout |
||
64 | * @param array $proxy_list |
||
65 | */ |
||
66 | public function __construct($host, $timeout, array $proxy_list) |
||
72 | |||
73 | /** |
||
74 | * Get host. |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getHost() |
||
82 | |||
83 | /** |
||
84 | * Set request. |
||
85 | * |
||
86 | * @param \Symfony\Component\HttpFoundation\Request $request |
||
87 | */ |
||
88 | public function setRequest(Request $request = null) |
||
98 | |||
99 | /** |
||
100 | * Get DOMDocument from path. |
||
101 | * |
||
102 | * Receive content from the URL, cleaning using Tidy and creating DOM document |
||
103 | * |
||
104 | * @param string $path |
||
105 | * |
||
106 | * @return \DOMDocument|null |
||
107 | */ |
||
108 | public function getDom($path) |
||
117 | |||
118 | /** |
||
119 | * Get content from path. |
||
120 | * |
||
121 | * Receive content from the URL and cleaning using Tidy |
||
122 | * |
||
123 | * @param string $path |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | public function getContent($path) |
||
159 | |||
160 | /** |
||
161 | * Get HTTP browser. |
||
162 | * |
||
163 | * @param \Guzzle\Http\Client |
||
164 | */ |
||
165 | protected function getBrowser() |
||
186 | } |
||
187 |
This method has been deprecated.