summaryrefslogtreecommitdiffstats
path: root/main.php
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-11-03 23:27:34 +0100
committersijanec <sijanecantonluka@gmail.com>2020-11-03 23:27:34 +0100
commit13b43f96111d4100ac0c21e81d91c2f0ad2a7577 (patch)
tree4b44896b63a9c09b4fcaa46c95a821da2910ed90 /main.php
parentcss (diff)
downloadoldredditclient-13b43f96111d4100ac0c21e81d91c2f0ad2a7577.tar
oldredditclient-13b43f96111d4100ac0c21e81d91c2f0ad2a7577.tar.gz
oldredditclient-13b43f96111d4100ac0c21e81d91c2f0ad2a7577.tar.bz2
oldredditclient-13b43f96111d4100ac0c21e81d91c2f0ad2a7577.tar.lz
oldredditclient-13b43f96111d4100ac0c21e81d91c2f0ad2a7577.tar.xz
oldredditclient-13b43f96111d4100ac0c21e81d91c2f0ad2a7577.tar.zst
oldredditclient-13b43f96111d4100ac0c21e81d91c2f0ad2a7577.zip
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") {