Facebook应用php发贴到朋友墙 [英] facebook application php post to friends wall
问题描述
我有一个脚本成功地发布到我的朋友的墙上链接和消息,但是当我打开循环如下:
I have a script that succesfully posts to my friend wall link and message, but when i turn on loop like this:
for ($i = $from; $i <= $to; $i++) {
$sendTo = $userid[$i];
echo '<p>sending user '.$i.'</p>';
if($result = $facebook->api("/$sendTo/feed/",'post', $attachment))
{
echo '<p>sended user '.$i.'</p>';
} else {
echo 'Oops something went wrong';
}}
它只发帖4或5条消息,然后中断。我认为问题是在Facebook不允许很多消息在短时间内发送。我如何做一些超时功能或东西发布至少100个消息?当我发布只有5条消息,我设法发布100个消息5乘5,但我需要发布100乘100你可以帮助我吗?
it only posts 4 or 5 messages and then break. I suppos the problem is at facebook does not allowing many message to send in short time. How can i make some timeout function or something to post at least 100 messages? When i post only 5 messages i manage to post 100 messages 5 by 5, but i need to post 100 by 100. Can you help me please?
谢谢你的时间和最好的问候
Thank you for your time and best regards
推荐答案
像Facebook这样的多个用户墙壁上发布是不鼓励的。如果要发送多个用户的消息,他们建议您使用请求对话框<一>。
Posting on multiple user's walls like this is discouraged by Facebook. If you want to send multiple users a message, they recommend you use the requests dialog.
为了延迟发送请求,您可以在每5个帖子之后添加一个 sleep(300)
命令,以提供5发布之间的时间延迟。你会遇到脚本超时的问题。更好的是让你的脚本创建一个cron工作,每次发布5个项目,每5分钟运行一次。
To delay sending requests, you could add a sleep(300)
command after every 5 posts to give a 5 minute delay between postings. You'll have problems with script timeouts. Better would be to have your script create a cron job that posts 5 items at a time, and only runs every 5 minutes.
使用这些方法之一,您的用户垃圾邮件,并且您的应用程序被禁用的风险。有关更多信息,请参阅 Facebook Developers博客文章。
With either of these methods, you are spamming your users and you run a risk of your app getting disabled. See this Facebook Developers blog post for more info.
这篇关于Facebook应用php发贴到朋友墙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!