1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Google Drive API

Discussion in 'Google API' started by Mona AbdelHady, Dec 3, 2013.

  1. #1
    Hello,

    Has anyone successfully created a php app to get a list of all docs in the google drive? I have followed many documentations but none was clear and couldn't find an example for just getting the files list.

    Thanks for you help,

    Mona
     
    Mona AbdelHady, Dec 3, 2013 IP
  2. QiSoftware

    QiSoftware Well-Known Member

    Messages:
    805
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    158
    #2
    This bookmark from the Google SDK Drive developers documentation did not help?

    Q...
     
    QiSoftware, Dec 24, 2013 IP
  3. ZevNoel

    ZevNoel Member

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #3
    May be something like this
    <?php
    session_start();
    
    $url_array = explode('?', 'http://'.$_SERVER ['HTTP_HOST'].$_SERVER['REQUEST_URI']);
    $url = $url_array[0];
    
    require_once 'google-api-php-client/src/Google_Client.php';
    require_once 'google-api-php-client/src/contrib/Google_DriveService.php';
    
    $client = new Google_Client();
    $client->setClientId(''); // Kept my id
    $client->setClientSecret(''); //kept my key
    $client->setRedirectUri($url);
    $client->setScopes(array('https://www.googleapis.com/auth/drive'));
    
    if (isset($_GET['code'])) {
    $_SESSION['accessToken'] = $client->authenticate($_GET['code']);
    header('location:'.$url);exit;
    } elseif (!isset($_SESSION['accessToken'])) {
    $client->authenticate();
    $client->setAccessToken($accessToken);
    } 
    PHP:
     
    ZevNoel, Jan 6, 2014 IP