reddit-php-sdk icon indicating copy to clipboard operation
reddit-php-sdk copied to clipboard

403 - Request forbidden by administrative rules

Open sfatfarma opened this issue 7 years ago • 3 comments

Hello,

I was using this sdk and until now it was working. Congrats for your work!

But recently, I noticed that it cannot post any more to Reddit and I get this error instead:

403 - Request forbidden by administrative rules

Can you help me please with this? Thank you very much.

Regards, Szabi.

sfatfarma avatar Aug 19 '17 17:08 sfatfarma

@sfatfarma I recently made a call to the api for the first time (i think) but I get the 403 error, have you been able to fix it? @jcleblanc any ideas, has something gone wrong?

Thanks KishanV

kishan-v avatar Sep 15 '17 22:09 kishan-v

Hello @Reaper03 No fix yet.

My code:

try
            {
                require_once(dirname(__FILE__) . "/res/reddit-sdk/reddit.php");
                $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
                $reddit = new reddit($app_id, $app_secret, $actual_link, false);
                if($reddit == false)
                {
                    //fail
                    return;
                }
            }
            catch(Exception $e)
            {
                //fail again
return;
            }
try {
                    $response = $reddit->createStory($post_template, $post_link, $subreddit);
                    if($response === null || $response === false)
                    {
//fail
return;
}
}
catch (Exception $e) {
                    //fail once again
return;
                }

sfatfarma avatar Sep 18 '17 06:09 sfatfarma

Oh shame thanks for the reply though, if u want I can direct you to another PHP wrapper that should work if not check out Praw (python)

kishan-v avatar Sep 18 '17 07:09 kishan-v