Skip to content

Commit

Permalink
Add paginateAccountMediaByUsername example
Browse files Browse the repository at this point in the history
  • Loading branch information
raiym committed Oct 31, 2017
1 parent 5384e4b commit 8fb8296
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ $medias $instagram->getLocationTopMediasById(1)
$medias = $instagram->getLocationMediasById(1);
$medias = $instagram->getTopMediasByTagName('hello');
```
### Paginate medias
```php
$result = Instagram::getPaginateMedias('kevin');
$medias = $result['medias']

if($result['hasNextPage'] === true) {
$result = Instagram::getPaginateMedias('kevin', $result['maxId']);
$medias = array_merge($medias, $result['medias']);
}

echo json_encode($medias);
```

### Search medias by tag name
```php
Expand Down
16 changes: 16 additions & 0 deletions examples/paginateAccountMediaByUsername.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
require __DIR__ . '/../vendor/autoload.php';


// getPaginateMedias() work with and without authorization
$instagram = \InstagramScraper\Instagram::withCredentials('username', 'password', '/path/to/cache/folder');
$instagram->login();

$result = $instagram->getPaginateMedias('kevin');
$medias = $result['medias'];
if ($result['hasNextPage'] === true) {
$result = $instagram->getPaginateMedias('kevin', $result['maxId']);
$medias = array_merge($medias, $result['medias']);
}

echo json_encode($medias);

0 comments on commit 8fb8296

Please sign in to comment.