Skip to content

Commit a31cf30

Browse files
committed
Restricted api calls in case of large number of comments on an article
1 parent b12e74e commit a31cf30

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

api_calls/helper.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ function apiCall($comments, $keyword)
66
global $repustateEndPoint;
77
$command = "curl -d topics=$keyword'";
88
$text = "";
9+
$c = 0;
910
foreach ($comments as $key => $comment){
10-
// $key = $key+1;
11+
if($c++ > 5) //To avoid articles with large number of comments to eat up api limits
12+
break;
1113
$comment = str_replace("'", '', $comment);
1214
$text .= "text$key=$comment&";
1315
}

0 commit comments

Comments
 (0)