1

So I am not sure how to fix this so that when a field is missing it writes NULL or zero (for count) instead of not creating the stats_file:

$stat_file = fopen("./".$feed_id_str."/"."stats.csv", 'w');
$stat_arr = [];
$stat_arr[] = $feed_id;
$stat_arr[] = $like_count_column;
$stat_arr[] = $comment_count_column;
$stat_arr[] = $comment_count_column;
fputcsv($stat_file, $stat_arr);
//fputcsv($stat_file, array($feed_id, $like_count_column, $comment_count_column, count($likers_and_commenters)));

This is the case for 1014185579136663000_1930504334 folder.

result is as follows:

mona@pascal:~/computer_vision/Instagram-API/test$ tree *_19*
1001637184153042399_1930504334
├── 1001637184153042399_1930504334.jpeg
├── caption.txt
├── commenters.txt
├── comments.txt
├── likers.txt
└── stats.csv
1011842647423434230_1930504334
├── 1011842647423434230_1930504334.jpeg
├── caption.txt
├── commenters.txt
├── comments.txt
├── likers_and_commenters.txt
├── likers.txt
└── stats.csv
1014184930034564556_1930504334
├── 1014184930034564556_1930504334.jpeg
├── caption.txt
├── commenters.txt
├── comments.txt
├── likers_and_commenters.txt
├── likers.txt
└── stats.csv
1014185579136663000_1930504334
├── 1014185579136663000_1930504334.jpeg
├── caption.txt
└── likers.txt
1037815588254367018_1930504334
├── 1037815588254367018_1930504334.jpeg
├── caption.txt
├── commenters.txt
├── comments.txt
├── likers_and_commenters.txt
├── likers.txt
└── stats.csv
998075460065934859_1930504334
├── 998075460065934859_1930504334.jpeg
├── caption.txt
├── commenters.txt
├── comments.txt
├── likers_and_commenters.txt
├── likers.txt
└── stats.csv
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408

0 Answers0