I am trying to pull fixtures data from Fantasy Premier League API. But i am stuck. I received string data instead of JSON data. It's been while since i used PHP, as i am more focused in JavaScript these days. Please guide me.
<?php
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$url = "https://fantasy.premierleague.com/api/fixtures/?event=1";
$response = file_get_contents($url, false, stream_context_create($arrContextOptions));
// echo $response;
$events = json_encode($response, true);
print_r($events);
?>
Variable $events gives me string instead array. It's because API is giving data in string format or i am doing something wrong.
Any help will be much appreciated. Thank You