mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-30 23:55:24 +02:00
fix: various small fixes (#3517)
* fix(asrocknews): Trying to get property src of non-object Trying to get property 'src' of non-object at bridges/ASRockNewsBridge.php line 37 * refactor(http): tweak max redirs config * fix(tiktok) * fix(gizmodo) * fix(craig) * fix(nationalg) * fix(roadandtrack) * fix(etsy)
This commit is contained in:
parent
1a529fac46
commit
7881c87bed
8 changed files with 20 additions and 11 deletions
|
@ -222,13 +222,14 @@ function _http_request(string $url, array $config = []): array
|
|||
'if_not_modified_since' => null,
|
||||
'retries' => 3,
|
||||
'max_filesize' => null,
|
||||
'max_redirections' => 5,
|
||||
];
|
||||
$config = array_merge($defaults, $config);
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
|
||||
curl_setopt($ch, CURLOPT_MAXREDIRS, $config['max_redirections']);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
$httpHeaders = [];
|
||||
foreach ($config['headers'] as $name => $value) {
|
||||
|
@ -302,10 +303,12 @@ function _http_request(string $url, array $config = []): array
|
|||
}
|
||||
if ($attempts > $config['retries']) {
|
||||
// Finally give up
|
||||
$curl_error = curl_error($ch);
|
||||
$curl_errno = curl_errno($ch);
|
||||
throw new HttpException(sprintf(
|
||||
'cURL error %s: %s (%s) for %s',
|
||||
curl_error($ch),
|
||||
curl_errno($ch),
|
||||
$curl_error,
|
||||
$curl_errno,
|
||||
'https://curl.haxx.se/libcurl/c/libcurl-errors.html',
|
||||
$url
|
||||
));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue