Skip to content

Commit

Permalink
add user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Rainbon committed May 10, 2017
1 parent 7dc84cd commit c5c0b5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
/bin/
/composer.phar
.idea
``.DS_Store
8 changes: 7 additions & 1 deletion src/AppBundle/Command/JobRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,13 @@ protected function crawl(Job $job)
$client = new Client();

try {
$response = $client->get($this->parseJobLink($job));
$response = $client->get($this->parseJobLink($job), [
'headers' => [
'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36',
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Referer' => 'http://www.edushi.com/'
]
]);
} catch (ClientException $exception) {
//$this->io->error($exception->getMessage());
return [null, null];
Expand Down

0 comments on commit c5c0b5c

Please sign in to comment.