打开图|发布操作|使用PHP代替cURL而不是终端 [英] Open Graph | Publish an Action | Using PHP for cURL instead of terminal

查看:164
本文介绍了打开图|发布操作|使用PHP代替cURL而不是终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用Facebook平台开发的新手。
我目前正在按照以下教程:
http:/ /developers.facebook.com/docs/beta/opengraph/tutorial/



我在步骤4的发布操作下。



它要我将代码片段直接复制到cURL终端:



唯一的问题是在联系我的webhost技术支持(1and1),他们告诉我,我是在一个共享主机计划,我不能直接访问终端,我将通过一个php脚本这样做。



我不知道该怎么做,任何人都可以请,请指出我的方向正确!!



这里是facebook给我的指示: / p>

发布操作



发布操作会将用户连接到您创建的对象。 Open Graph Dashboard页面在您的操作旁边有一个获取代码链接。



发布动作涉及对我/ /命名空间进行HTTP POST:[action_type] Graph API端点具有以下参数:

  [object_type]:指向表示对象的网页的链接。 
access_token:有效用户access_token,具有publish_actions权限。

例如,发送POST到:



https://graph.facebook.com/me/YOUR_NAMESPACE:cook
?recipe = OBJECT_URL& access_token = ACCESS_TOKEN



这将针对与所提供的OBJECT_URL对应的食谱发布烹饪动作。将OBJECT_URL替换为您的网页网址。

解决方案

您应该使用 PHP的内置cURL支持,而不是终端调用。


I am new to the developing with the facebook platform. I'm currently following the tutorial here: http://developers.facebook.com/docs/beta/opengraph/tutorial/

I am at step 4, under "Publish an action".

Where it wants me to copy the code snippet directly into the cURL terminal:

The only problem is while contacting my webhost technical support(1and1), they informed me that I was on a shared hosting plan and that I could not access the terminal directly and I would have to do this through a php script.

I don't know how to do this, can anyone please, please point me in the right direction!!

Here are the instructions facebook gives me:

Publish an Action

Publishing an action connects the user to the object you created. The Open Graph Dashboard page has a 'Get Code' link next to your action. This contains curl code snippets that you can copy into terminal and run directly.

Publishing an action involves making an HTTP POST to the me/[namespace]:[action_type] Graph API endpoint with the following parameters:

[object_type]: a link to a web page representing an object.
access_token: a valid user access_token with publish_actions permissions.

For example, sending a POST to:

https://graph.facebook.com/me/YOUR_NAMESPACE:cook ?recipe=OBJECT_URL&access_token=ACCESS_TOKEN

This will publish a cook action for the recipe corresponding to the provided OBJECT_URL. Replace OBJECT_URL with your web page URL.

解决方案

You should be using PHP's built-in cURL support, not terminal calls.

这篇关于打开图|发布操作|使用PHP代替cURL而不是终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆