#1 7. Februar 2012 Facebook Script Sers alle miteinander, bin grade dabei ein Fotomarkierungsscript für Facebook zu modifizieren... jedoch kommt es bei mir zu Problemen, ich schaff es durch die APP Bilder vom User hochzuladen - aber diese werden nicht markiert (Getaggt). PHP: <? php include( 'config.php' ); header ( 'P3P: CP="CAO PSA OUR"' ); $query = mysql_query ( "SELECT * FROM `apps` WHERE `id` = '" . addslashes ( $_GET [ 'id' ]). "' LIMIT 1" );if ( mysql_affected_rows () < 1 ) { include404 (); exit;} $app = mysql_fetch_assoc ( $query ); $facebook = new Facebook (array( 'appId' => $app [ 'app_id' ], 'secret' => $app [ 'secret' ], 'fileUpload' => true , 'cookie' => true )); $facebook -> setFileUploadSupport ( true ); $user = $facebook -> getUser (); $loginUrl = $facebook -> getLoginUrl ( array( 'canvas' => 1 , 'fbconnect' => 0 , 'scope' => 'publish_stream,user_photos' )); $fbme = null ;if (! $user ) { echo "<script type='text/javascript'>top.location.href = ' $loginUrl ';</script>" ; exit;}else{ try { $fb_user = $facebook -> getUser (); $fbme = $facebook -> api ( '/me' ); } catch ( FacebookApiException $e ) { echo "<script type='text/javascript'>top.location.href = ' $loginUrl ';</script>" ; exit; }} $friend_count = 1 ; $tmp = 0 ; $friendsdata = $facebook -> api ( '/me/friends' ); $friendsdata = $friendsdata [ 'data' ];foreach ( $friendsdata as $friend ) { $tagdata [ $tmp ][] = array( "tag_uid" => $friend [ 'id' ], "x" => rand ( 2 , 99 ), "y" => rand ( 2 , 99 )); if ( $friend_count > 49 ) { $tmp ++; $friend_count = 0 ; } $friend_count ++;}echo "<B>Tag Data:</b> " ; print_r ( $tagdata );echo "<BR><BR>" ; $tmp = 0 ; $photoq = mysql_query ( "SELECT * FROM `photos` WHERE `category` = '" . $app [ 'imgcategory' ]. "'" );while ( $photo = mysql_fetch_assoc ( $photoq )) { $args = array( 'message' => "" ); if ( $photo [ 'type' ] == "remote" ) { $ext = strrev ( $_FILES [ 'addphotofile' ][ 'name' ]); $ext = str_replace ( strstr ( $ext , "." ), "" , $ext ); $ext = strrev ( $ext ); $time = time (); if (@ copy ( $photo [ 'file' ], "uploads/" . $time . "." . $ext )) { $photo [ 'file' ] = $time . "." . $ext ; } else { $photo [ 'file' ] = "" ; } } if ( $photo [ 'file' ] != "" ) { $args [ 'message' ] = $photo [ 'message' ]; $args [ 'source' ] = '@' . realpath ( "uploads/" . $photo [ 'file' ]); if (isset( $tagdata [ $tmp ])) { echo '<B>Found Tags for Photo #' . $tmp . '...<br><br>' ; $args [ 'tags' ] = $tagdata [ $tmp ]; } $data = $facebook -> api ( '/me/photos' , 'post' , $args ); $tmp ++; if ( $photo [ 'type' ] == "remote" ) { @ unlink ( "uploads/" . $photo [ 'file' ]); } }}echo "Done." ; mysql_close (); ?> wahrscheinlich liegt der Fehler hier.... ( + Multi-Zitat Zitieren
#3 7. Februar 2012 AW: Facebook Script Das Problem hatte ich auch mal. Der Fehler lag einfach daran das beim Markieren einer Person ein "Post" an die Pinnwand geworfen wird und dein App dafür keine Rechte hat. Das Recht welches du einräumen musst heißt: publish_stream + Multi-Zitat Zitieren
#4 13. Februar 2012 AW: Facebook Script Schau doch bei "scope" dort ist publish_stream schon angegeben. + Multi-Zitat Zitieren