Return to Snippet

Revision: 28669
at July 12, 2010 13:50 by kwanhon


Initial Code
$token = $session['access_token'];

    //upload photo
    $file= 'photo.jpg';
    $args = array(
    'message' => 'Photo from application',
    );
    $args[basename($file)] = '@' . realpath($file);

    $ch = curl_init();
    $url = 'https://graph.facebook.com/me/photos?access_token='.$token;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
    $data = curl_exec($ch);

Initial URL

                                

Initial Description

                                

Initial Title
Facebook Upload Photo API

Initial Tags

                                

Initial Language
PHP