summaryrefslogtreecommitdiffstats
path: root/main.php
diff options
context:
space:
mode:
Diffstat (limited to 'main.php')
-rw-r--r--main.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/main.php b/main.php
index 31dee80..e453cae 100644
--- a/main.php
+++ b/main.php
@@ -209,6 +209,7 @@ Errors:
}
if ($limit>100) {
echo "\n[oldredditclient] WARN get(): multipage not implemented (limit>100)!\n";
+ return -4;
}
$ch = $this->ch;
switch($what) {
@@ -225,7 +226,7 @@ Errors:
}
$arr = json_decode($response, true, 512);
return $arr;
- break;
+ break;
case "post":
curl_setopt($ch, CURLOPT_URL, $this->redditurl.$value.".json");
curl_setopt($ch, CURLOPT_POST, 0);
@@ -239,8 +240,24 @@ Errors:
}
$arr = json_decode($response, true, 512);
return $arr;
+ break; // unreachable code amirite
+ case "comments": // value=r/Slovenia || value=u/first
+ curl_setopt($ch, CURLOPT_URL, $this->redditurl.$value."/comments/.json");
+ curl_setopt($ch, CURLOPT_POST, 0);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+ "X-Modhash: ".$this->modhash,
+ "X-ContactBotDeveloper: ".$this->adminemail
+ ));
+ $response = curl_exec($ch);
+ if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) != 200) {
+ return false;
+ }
+ $arr = json_decode($response, true, 512);
+ return $arr;
+ break; // te breake delam nagonsko
default:
return -5;
+ break;
}
}
public function comment($text = "oldredditClient", $in_reply_to = "jd2fm5") {