InstagramScraper\Endpoints::getMediasJsonByLocationIdLink PHP Метод

    public static function getMediasJsonByLocationIdLink($facebookLocationId, $maxId = '')
    {
        $url = str_replace('{{facebookLocationId}}', urlencode($facebookLocationId), Endpoints::MEDIA_JSON_BY_LOCATION_ID);
        return str_replace('{{maxId}}', urlencode($maxId), $url);
    }

Usage Example

Пример #1
0
 public static function getLocationById($facebookLocationId)
 {
     $response = Request::get(Endpoints::getMediasJsonByLocationIdLink($facebookLocationId));
     if ($response->code === 404) {
         throw new InstagramNotFoundException('Location with this id doesn\'t exist');
     }
     if ($response->code !== 200) {
         throw new InstagramException('Response code is ' . $response->code . '. Body: ' . $response->body . ' Something went wrong. Please report issue.');
     }
     $jsonResponse = json_decode($response->raw_body, true);
     return Location::makeLocation($jsonResponse['location']);
 }