我正在尝试通过Graph API在Facebook页面中创建帖子链接。所有的参数都运行正常,唯一的不是图片。
我在桌面上放置了图片的网址,但它无法正常工作,我收到此错误:(#100)图片网址格式不正确
任何人都知道我该怎么办?或者,如果可以在页面链接中上传您的作品中的图片吗?
这是我正在使用的代码(我隐藏了一些有关我的密码和令牌的信息):
<?php
session_start();
require_once( 'Facebook/FacebookHttpable.php' );
require_once( 'Facebook/FacebookCurl.php' );
require_once( 'Facebook/FacebookCurlHttpClient.php' );
require_once( 'Facebook/FacebookSession.php' );
require_once( 'Facebook/FacebookRedirectLoginHelper.php' );
require_once( 'Facebook/FacebookRequest.php' );
require_once( 'Facebook/FacebookResponse.php' );
require_once( 'Facebook/FacebookSDKException.php' );
require_once( 'Facebook/FacebookRequestException.php' );
require_once( 'Facebook/FacebookClientException.php' );
require_once( 'Facebook/FacebookOtherException.php' );
require_once( 'Facebook/FacebookAuthorizationException.php' );
require_once( 'Facebook/FacebookPermissionException.php' );
require_once( 'Facebook/FacebookServerException.php' );
require_once( 'Facebook/GraphObject.php' );
require_once( 'Facebook/GraphSessionInfo.php' );
require_once( 'Facebook/GraphUser.php' );
use Facebook\FacebookHttpable;
use Facebook\FacebookCurl;
use Facebook\FacebookCurlHttpClient;
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookClientException;
use Facebook\FacebookOtherException;
use Facebook\FacebookAuthorizationException;
use Facebook\FacebookPermissionException;
use Facebook\FacebookServerException;
use Facebook\GraphObject;
use Facebook\GraphSessionInfo;
use Facebook\GraphUser;
FacebookSession::setDefaultApplication('app name','app password');
$session = new FacebookSession('token');
$message = 'Test';
$link = "http://www.example.com";
$description = 'Descriptionnn';
$name = 'Nameeee';
$caption = 'Captionnnnnnnn';
$picture = 'file:///C:/Users/VIrgilio/Desktop/Petlove/Facebook%20Ads/Campanhas/Assento/Link/Assento-Novo.png';
$request = new FacebookRequest(
$session,
'POST',
'/page_id/feed',
array (
'message' => $message,
'link' => $link,
'description' => $description,
'published' => 'false',
'name' => $name,
'caption' => $caption,
'picture' => $picture,
)
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
?>
由于
答案 0 :(得分:0)
图片网址应该类似于https://www.example.com/image.jpg