SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2008
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help needed on Photos.upload Facebook api...

    Hi there,
    I am trying to upload a photo to my facebook profile...But, so far I haven't been able to...I would be glad if anyone could help me...

    This is the code I have used....and it's not working for me...please help


    PHP Code:
    <?php
     $key 
    '01cc0f650d99e8a6ab2656a18c6b5b81';  
     
    $sec 'ae7990a55fbd96cc70c8f5ef6f4d7ba7';  
     
    $ver '1.0';  
     
    $cid microtime(true);  
     
    $uid 'BIGINT';  
     
    $file'/path/file.jpg';  
       
     
    $args = array(  
       
    'method' => 'photos.upload',  
       
    'v' => $ver,  
       
    'api_key' => $key,  
       
    'uid' => $uid,  
       
    'call_id' => $cid,  
       
    'format' => 'XML'  
     
    );  
     
    signRequest($args$sec);  
     
    $args[basename($file)] = '@' realpath($file);  
       
     
    $ch curl_init();  
     
    $url 'http://api.facebook.com/restserver.php?method=photos.upload';  
     
    curl_setopt($chCURLOPT_URL$url);  
     
    curl_setopt($chCURLOPT_HEADERfalse);  
     
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);  
     
    curl_setopt($chCURLOPT_POSTtrue);  
     
    curl_setopt($chCURLOPT_POSTFIELDS$args);  
     
    $data curl_exec($ch);  
       
     echo 
    $data;  
       
     function 
    signRequest(&$args$secret){  
       
    ksort($args);  
       
    $sig '';  
       foreach(
    $args as $k => $v){  
         
    $sig .= $k '=' $v;  
       }  
       
    $sig .= $secret;  
       
    $args['sig'] = md5($sig);  
     } 
    ?>

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    careful what you post in public display, hope these not security sensitive materials

    Code:
    $key = '01cc0f650d99e8a6ab2656a18c6b5b81';  
    $sec = 'ae7990a55fbd96cc70c8f5ef6f4d7ba7';


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •