Add user agent to ApiFetcher

master
Skylar Ittner 1 year ago
parent 8783d52cc7
commit d851807935

@ -49,7 +49,11 @@ class ApiFetcher {
// Make the actual URL that will be requested
$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
if ($content !== FALSE) {

@ -21,14 +21,14 @@ class NewsCategory {
const SOCIAL = 128;
const CATEGORIES = [
self::BUSINESS => "Business",
self::ENTERTAINMENT => "Entertainment",
self::GENERAL => "General",
self::HEALTH => "Health",
self::SCIENCE => "Science",
self::SPORTS => "Sports",
self::TECHNOLOGY => "Technology",
self::SOCIAL => "Social"
self::BUSINESS => "business",
self::ENTERTAINMENT => "entertainment",
self::GENERAL => "general",
self::HEALTH => "health",
self::SCIENCE => "science",
self::SPORTS => "sports",
self::TECHNOLOGY => "technology",
self::SOCIAL => "social"
];
public function __construct(int $category) {

Loading…
Cancel
Save