English 中文(简体)
Facebook Opengraph 阅读动作
原标题:Facebook Opengraph Read Action

没错,我问了一个类似的问题,但是没有连贯地说,所以在这里去。

我试图用脸书的公开简写来鼓动读者阅读我网站上使用php代码的文章。

我想用开版图为当前 URL 发布读取动作 。 我尝试过这个, 但是没有喜悦

    <?php
function curPageURL() {
 $pageURL =  http ;
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
?>





<?php

$facebook->api( https://graph.facebook.com/me/:read?  
                article= echo curPageURL();  , POST )


?>

正如许多聪明的木棍指出,我是一个新手,这是我最好的尝试,所以请耐心

问题回答

API 调用似乎不正确。 如果您正在使用嵌入读取动作, 请尝试 :

$facebook->api( /me/news.reads?article=  . curPageURL(), POST );

您不需要在 API 调用中使用完整的图形 URL 。 请确定您也有权限为用户发布动作, 否则 API 调用将会失败 。 如果调用成功, 您将会得到已发布动作的 ID 。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签