[FacebookBridge] Prevent sending empty header (#1239)
* [FacebookBridge] Prevent sending empty header When running in CLI mode, `getEnv('HTTP_ACCEPT_LANGUAGE')` returns `false`. In that case, don't send the `Accept-Language` header.
This commit is contained in:
parent
3254a4d7bc
commit
53fbd2a5a0
1 changed files with 10 additions and 2 deletions
|
@ -142,7 +142,11 @@ class FacebookBridge extends BridgeAbstract {
|
|||
|
||||
private function collectGroupData() {
|
||||
|
||||
$header = array('Accept-Language: ' . getEnv('HTTP_ACCEPT_LANGUAGE') . "\r\n");
|
||||
if(getEnv('HTTP_ACCEPT_LANGUAGE')) {
|
||||
$header = array('Accept-Language: ' . getEnv('HTTP_ACCEPT_LANGUAGE'));
|
||||
} else {
|
||||
$header = array();
|
||||
}
|
||||
|
||||
$html = getSimpleHTMLDOM($this->getURI(), $header)
|
||||
or returnServerError('Failed loading facebook page: ' . $this->getURI());
|
||||
|
@ -505,7 +509,11 @@ EOD;
|
|||
// Retrieve page contents
|
||||
if(is_null($html)) {
|
||||
|
||||
$header = array('Accept-Language: ' . getEnv('HTTP_ACCEPT_LANGUAGE'));
|
||||
if(getEnv('HTTP_ACCEPT_LANGUAGE')) {
|
||||
$header = array('Accept-Language: ' . getEnv('HTTP_ACCEPT_LANGUAGE'));
|
||||
} else {
|
||||
$header = array();
|
||||
}
|
||||
|
||||
$html = getSimpleHTMLDOM($this->getURI(), $header)
|
||||
or returnServerError('No results for this query.');
|
||||
|
|
Loading…
Reference in a new issue