Advertisement
lamiastella

fopen warning

Mar 6th, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1.    $comment_helper = null;
  2.     $comments = [];
  3.     $fp = fopen($_SERVER['DOCUMENT_ROOT']. "1460725204439623926.txt", "a");
  4.  
  5.     do {
  6.         if (is_null($comment_helper)) {
  7.             $comment_helper = $i->getMediaComments(1460725204439623926);
  8.         } else {
  9.             $comment_helper = $i->getMediaComments(1460725204439623926, $comment_helper->getNextMaxId());
  10.         }
  11.         $comments = array_merge($comments, $comment_helper->getComments());
  12.     } while (!is_null($comment_helper->getNextMaxId()));
  13.  
  14.     foreach ($comments as $comment) {
  15.         try {
  16.             if(strlen($comment->text) == mb_strlen($comment->text, 'utf-8')) {
  17.                 fwrite($fp, '- '.$comment->text."\n");
  18.             }
  19.         }
  20.         catch (InstagramException $ie) {
  21.             echo $ie.getCode();
  22.             sleep(6);
  23.         }
  24.        fclose($fp);
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement