Facebook Php Api User 0

Facebook Php Api User 0

weslharye




Facebook Php Api User 0

http://shorl.com/fofryrigruseho






















Setting up a Facebookapplication Before youre able to start, its necessary to have a Facebook account and a web hosting account. Enter the domain were your web application is hosted or better click the Add Platform button -> Website and enter the web application URL (directory) where your web application is located. SupportPlatform StatusDevelopers GroupMarketing PartnersBugs.. To access the Facebook APIyouneed an App IDand secret. Thanks you so much Olaf Lederer Hi Emily, The Graph API is very limited in what you can post, posting an image is not always possible. I need to write a small web app in PHP which able to read private messages from inbox of the Facebook Page and also reply to the sender. printr( $graphObject, 1 ) . if I only put message, it will work. If you understand how it works, you can use this function (a bit modified) as a social feature forthe comments form on your WordPress website. it seems i cant get a session :S Reply Olaf Lederer Do you authorized the session using your own Facebook account? The example script is just a demo not an application& if it works on my demo page, the same code should work for you, too. Any suggestions as to where to look? Reply Olaf Lederer Hi Pete, check the demo, Im using the same code like in the tutorial. Facebook API PHP example Create inside yournew directory a new PHP file and add the following code: PHP validate() ) $session = null; } catch ( Exception $e ) { // catch any exceptions and set the sesson null $session = null; echo 'No session: '.$e->getMessage(); } } elseif ( empty( $session ) ) { // the session is empty, we create a new one try { // the visitor is redirected from the login, let's pickup the session $session = $helper->getSessionFromRedirect(); } catch( FacebookRequestException $e ) { // Facebook has returned an error echo 'Facebook (session) request error: '.$e->getMessage(); } catch( Exception $e ) { // Any other error echo 'Other (session) request error: '.$e->getMessage(); } } 1234567891011121314151617181920212223242526272829303132 / initialize your app using your key and secretFacebookSession::setDefaultApplication($apikey, $apisecret);// create a helper opject which is needed to create a login URL// the $redirectloginurl is the page a visitor will come to after login$helper = new FacebookRedirectLoginHelper( $redirectloginurl);// First check if this is an existing PHP sessionif ( isset( $SESSION ) && isset( $SESSION['fbtoken'] ) ) { // create new session from the existing PHP sesson $session = new FacebookSession( $SESSION['fbtoken'] ); try { // validate the accesstoken to make sure it's still valid if ( !$session->validate() ) $session = null; } catch ( Exception $e ) { // catch any exceptions and set the sesson null $session = null; echo 'No session: '.$e->getMessage(); }}elseif ( empty( $session ) ) { // the session is empty, we create a new one try { // the visitor is redirected from the login, let's pickup the session $session = $helper->getSessionFromRedirect(); } catch( FacebookRequestException $e ) { // Facebook has returned an error echo 'Facebook (session) request error: '.$e->getMessage(); } catch( Exception $e ) { // Any other error echo 'Other (session) request error: '.$e->getMessage(); }} After the application is initiated thehelper object is created. Reply mary I am trying to upload photo through api but it showing me this error. SDKsiOS SDKAndroid SDKJavaScript SDKPHP SDKUnity SDK. The GET request is almost the same as the previous POST request. After the app is created, click on Settings in the left menu. Share This Share this post with your friends! Facebook Twitter Google+ Pinterest LinkedIn Buffer . PHP echo ' ' . SDKsiOS SDKAndroid SDKJavaScript SDKPHP SDKUnity SDK. Any idea why? By the way, what I want to achieve is this. ' '; $msgid = $graphObject->getProperty('id'); } catch ( FacebookRequestException $e ) { // show any error for this facebook request echo 'Facebook (post) request error: '.$e->getMessage(); } This part of the script does the following: If $session exists, the scriptstores the object inside a PHP session variable and a new Facebook session object is created. From the top menu select Apps => Create a New App to open the pop-up for your app details. If you followed all steps and doesnt work, its possible that you didnt authorized your own app as a regular Facebook user. ProductsFacebook LoginSharing on FacebookGamesFacebook App Ads. I used $session, POST, /me/photos, array( //link => source => new CURLFile(path/to/file.name, image/png), message => welcome to uni it failed also. The example script is not ready to use, if you didnt created a valid Facebook app in your account. If the session isnt valid or empty the helper object is used to create a new session from the login / redirect. But if I add link, it wont work. thanks Reply Bostjan Karlic Can you tell me if this aplication use FB API graph 2.xx or still 1.0? Reply Olaf Lederer I have written this code/tutorial for the PHP SDK (version 4.0), which supports the latest Open Graph API 2.x. I remember my that I tried something similar for a WordPress site and finally I used a IFTTT recipe Reply Ivn T. part of this ID $parts = explode('', $msgid); try { $request2 = new FacebookRequest( $session, 'GET', '/'.$parts[1] ); $response2 = $request2->execute(); $graphObject2 = $response2->getGraphObject(); // the GET response object echo ' ' . ProductsFacebook LoginSharing on FacebookGamesFacebook App Ads. ' 1 echo ' ' . I am just trying to post to my own page with php, not from my machine where I am logged in to Facebook. 7ads6x98y 5a02188284