Add user agent to ApiFetcher
This commit is contained in:
parent
8783d52cc7
commit
d851807935
@ -49,7 +49,11 @@ class ApiFetcher {
|
|||||||
// Make the actual URL that will be requested
|
// Make the actual URL that will be requested
|
||||||
$requesturl = $url . "?" . implode("&", $urlparams);
|
$requesturl = $url . "?" . implode("&", $urlparams);
|
||||||
|
|
||||||
$content = file_get_contents($requesturl);
|
$content = file_get_contents($requesturl, false, stream_context_create([
|
||||||
|
"http" => [
|
||||||
|
"header" => "User-Agent: Mozilla/5.0 (PHP) See source.netsyms.com"
|
||||||
|
]
|
||||||
|
]));
|
||||||
|
|
||||||
// Only insert into db if it didn't fail horribly
|
// Only insert into db if it didn't fail horribly
|
||||||
if ($content !== FALSE) {
|
if ($content !== FALSE) {
|
||||||
|
@ -21,14 +21,14 @@ class NewsCategory {
|
|||||||
const SOCIAL = 128;
|
const SOCIAL = 128;
|
||||||
|
|
||||||
const CATEGORIES = [
|
const CATEGORIES = [
|
||||||
self::BUSINESS => "Business",
|
self::BUSINESS => "business",
|
||||||
self::ENTERTAINMENT => "Entertainment",
|
self::ENTERTAINMENT => "entertainment",
|
||||||
self::GENERAL => "General",
|
self::GENERAL => "general",
|
||||||
self::HEALTH => "Health",
|
self::HEALTH => "health",
|
||||||
self::SCIENCE => "Science",
|
self::SCIENCE => "science",
|
||||||
self::SPORTS => "Sports",
|
self::SPORTS => "sports",
|
||||||
self::TECHNOLOGY => "Technology",
|
self::TECHNOLOGY => "technology",
|
||||||
self::SOCIAL => "Social"
|
self::SOCIAL => "social"
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(int $category) {
|
public function __construct(int $category) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user