简体   繁体   English

Facebook API(图)将网站照片发送到墙上

[英]Facebook API (graph) to send website photo to wall

I need a basic, how-to guide on how to take a picture from MY webpage, click a button and that button action will send a specific image to the user wall, with some text... Can you tell me exactly the steps to do that. 我需要一个基本的操作指南,如何从我的网页上拍照,点击一个按钮,按钮操作会将特定图像发送到用户墙,带有一些文字...你能告诉我到底的步骤吗?去做。

I have read the Facebook developer forum, the FB.ui but everything echo out : error FB.ui is not defined event 我已经阅读了Facebook开发者论坛,FB.ui但是一切都回响了:错误FB.ui没有定义事件

here is my code in html file : 这是我在html文件中的代码:

<div id="fb-root"></div>
<script type="text/javascript">
    window.fbAsyncInit = function() {
        FB.init({appId: 'some weird number things like that : ZCWjysg4SYlkg0gZDZD', status: true, cookie: true, xfbml: true});
    };
    (function() {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol +
            '//connect.facebook.net/en_US/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
    }());

and that code in javascript jQuery trigger button: 和javascript jQuery触发按钮中的代码:

FB.ui(
  {
    method: 'feed',
    name: 'Facebook Dialogs',
    link: 'http://developers.facebook.com/docs/reference/dialogs/',
    picture: 'http://fbrell.com/f8.jpg',
    caption: 'Reference Documentation',
    description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
  },
  function(response) {
    if (response && response.post_id) {
      alert('Post was published.');
    } else {
      alert('Post was not published.');
    }
  }
);

I have absolutely no idea how to do that... and event some code in some site are wrong (errors) 我完全不知道如何做到这一点...事件某些网站中的某些代码是错误的(错误)

I think here : http://developers.facebook.com/docs/reference/api/post/ it's the best source of information to know how, but i missing the basic step 1. 2. 3. 我想在这里: http//developers.facebook.com/docs/reference/api/post/它是了解如何获得最佳信息的最佳来源,但我错过了基本步骤1. 2. 3。

From your code, the appId is wrong!! 从您的代码, appId是错误的! App Id is all digits, specifically 15 digits, in some places it is also called the api key. App Id是所有数字,特别是15位数,在某些地方它也称为api密钥。 What you have posted seems like the app secret, which shouldn't be put in the JS anyway. 您发布的内容似乎是app秘密,无论如何都不应该放在JS中。
To get an app id you have to create an app in the developer app , or visit this link . 要获取应用ID,您必须在开发者应用中创建应用 ,或访问此链接

Then register the Javascript SDK, you can refer this url . 然后注册Javascript SDK,你可以参考这个url

Then call the FB.ui method, refer this url . 然后调用FB.ui方法,参考这个url
Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM