HashDivya
u/HashDivya
I Had tried with the documented api and the code is like:
$url = 'https://www.reddit.com/message/inbox.json';
$fields = array (
'after' => null;
'before' => null;
'limit' => 10,
'show' => 'all'
);
$header = array("Authorization:$this->accesstokentype $this->accesstoken");
$credentials = $this->clientid.':'.$this->clientsecret;
$useragent = ' by /u/' . $this->username;
$response = $this->request($url, $fields, 'GET',$header,$credentials,$useragent);
print_r($response);
What am I missing here?
Thany you....
What is the curl call or API call to get a post details?
reddit.com/r/redditapi/comments/b3nlqn/what_i...What is the curl call or API call to get a post details?
reddit.com/r/redditapi/comments/b3nlqn/what_i...I am able to post to a subreddit, now i want to read the votes and comments of a particular post. How can i get it.
Please any suggestions!
Share your interest's
Able to successfully post to a sub-Reddit but how to count the upvotes and comments of a particular post.
Help me with this. Thank you for reading.
I am developing an script app using php. So, I want to get the Oauth code within script only how can i can that.Thank you for reading and please suggest me.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://oauth.reddit.com/api/me');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_USERAGENT, ' by /u/' . $username . ' (Phapper 1.0)' );
$headers = array();
$headers[] = 'Authorization: bearer 239929*****';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
print_r($result);
curl_close ($ch);
What is missing in the above code?
function access_token() {
$this->username = readline("Enter username: ");
$this->password = readline("Enter password: ");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.reddit.com/api/v1/access_token");
curl_setopt($ch, CURLOPT_USERPWD, $this->clientId . ':' . $this->clientSecret );
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,"grant_type=password&username=$this->username&password=$this->password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
$response = json_decode($server_output , true);
cu
You've reached the end of this feed.