Skip to content

Commit 5bfe7f2

Browse files
committed
Add context to set a timeout, fixes #6
1 parent 34180d4 commit 5bfe7f2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Script/Helper/Downloader.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ class Downloader
1616
*/
1717
public function isAccessible($url)
1818
{
19-
return is_resource(@fopen($url, 'r'));
19+
$context = StreamContextFactory::getContext($url, [
20+
'http' => ['timeout' => 5]
21+
]);
22+
23+
return is_resource(@fopen($url, 'r', null, $context));
2024
}
2125

2226
/**

0 commit comments

Comments
 (0)