Getting 403 Forbidden in SharePoint 365 PHP Rest API

I am using PHP rest API in SharePoint 365 to upload the file, I am using SharePoint-OAuth-app-client library (https://github.com/wearearchitect/sharepoint-oauth-app-client). In that I got accesstoken but when I try to execute folder list code I getting 403 error.

//Working code

require 'vendor/autoload.php';

use WeAreArchitectSharePointSPException;
use WeAreArchitectSharePointSPList;
use WeAreArchitectSharePointSPSite;
use WeAreArchitectSharePointSPFile;
use WeAreArchitectSharePointSPFolder;

try {
    $settings = [
        'site' => [
            'resource'  => '00000000-0000-ffff-0000-000000000000/example.sharepoint.com@09g7c3b0-f0d4-416d-39a7-09671ab91f64',
            'client_id' => '52848cad-bc13-4d69-a371-30deff17bb4d/example.com@09g7c3b0-f0d4-416d-39a7-09671ab91f64',
            'secret'    => 'YzcZQ7N4lTeK5COin/nmNRG5kkL35gAW1scrum5mXVgE=',
        ]
    ];

    // create a SharePoint Site instance
    $site = SPSite::create('https://example.sharepoint.com/sites/mySite/', $settings);

    // generate an Access Token (App-only Policy)
    $site->createSPAccessToken();

//Error From here

// get a Folder by relative URL
    $folder = SPFolder::getByRelativeUrl($site, 'myFolder');

    // get a List by title
    $folder = SPList::getByTitle($site, 'My List');

    // get all the Files from the Folder/List we just got
    $files = SPFile::getAll($folder);

    // do something with the files
    foreach ($files as $file) {
        var_dump($file);
    }

Please help me to solve this issue.
Thanks in Advanced


Source: stackoverflow-php

Laravel 5.3 Slack integration

I need to get access to Slack’s Event API from my Laravel 5.3 application. I have installed vluzrmos’s package from GitHub, but I can’t get it to work properly. I ran through all the steps in the installation, but when I try to do SlackUser::lists() in my Controller I get an error like this: Non-static method VluzrmosSlackApiContractsSlackUser::lists() cannot be called statically, assuming $this from incompatible context.

Could you help? Thanks


Source: stackoverflow-php