Commits

Gaurav Toshniwal committed be38cb1 Merge
  • Participants
  • Parent commits ec585db, f2df13f

Comments (0)

Files changed (3)

File cards/98127398.png

Old
Old image
New
New image
 <?php
 require 'scripts/facebook.php';
 require 'session.php';
-$your_base64_string=$_SESSION['image_data'];
 	session_start();
 	if (isset($_SESSION['image_data'])) {
-		echo $_SESSION['image_data'];
+		//echo $_SESSION['image_data'];
 	}
 	else {
 		'no session data';
 	}
 
+$your_base64_string=$_SESSION['image_data'];
 function base64_to_jpeg( $base64_string, $output_file ) {
   if(file_exists($output_file)) unlink($output_file);
   $ifp = fopen( $output_file, "wb" ); 
   return( $output_file ); 
 }
 $facebook = new Facebook(array(
-  'appId'  => '382132615191193',
-  'secret' => 'ce402aee16df3ff392656f4fd6678a53',
+  'appId'  => '498536373508574',
+  'secret' => 'c1d83ab7fc35c7543da033bbf35cb4a1',
 
 ));
 $facebook->setFileUploadSupport(true);
 $image = base64_to_jpeg( $your_base64_string, 'tmp.png' );
-$args = array('message' => 'Some message','access_token' => $facebook->getAccessToken(),'image' => '@' . realpath( $image );
-);
+//$args = array('message' => 'Some message','access_token' => $facebook->getAccessToken());
+$args = array('message' => 'Some message','access_token' => $facebook->getAccessToken(),'image' => '@'.realpath($image));
 echo $args['access_token'];
+echo '<br/>'.$facebook->getAccessToken();
+echo '</br/>';
 echo realpath($image);
 $data = $facebook->api('/me/photos', 'post', $args);
 unlink($image);

File tmp.png

Old
Old image
New
New image