Facebook php api conflict between url and picture - php

Something strange happens using the facebook feed, if I enter the destination URL in the format "app.facebook.com/..." the stream of public information correctly including the attached image, but if I change the link in the "www.facebook.com/page_name/APP_ID", no image appears into stream.
Code below:
$publishStream = $facebook->api("/$session/feed", 'post', array(
'message' => "Message",
'picture' => URL_APP,
'name' => 'Name',
'description'=> 'Description',
'link' => 'https://www.facebook.com/PageName?sk=app_1447229...',
)
);

Related

How to put inside Facebook message feed "profile link" used API?

How to put inside Facebook message feed "profile link" used API ?
For now I have prepared this code:
$request = $this->fb->post('/'.$this->pageId.'/feed', [
'message' => "
I'ves been testing my IQ! #facebook \n\t
#test #testt #testowy\n\t
http://www.example.com
",
'name' => 'Some title',
'caption' => 'some caption',
'link' => 'http://www.example.com',
'actions' => json_encode(array('name'=>'Some name','link'=>'http://www.example.com')),
'description' => 'Some description #example',
'picture' => 'http://www.example.com/image.jpg'
]);
published post view:
published post view (image)
It looks nice but I'd like change #facebook to link to profile link to look like this:
published post view after changes (image)
Some advice, how to make this?

Facebook development - post link with photo

I'm building an app for facebook. I need to post some link, standard code works correctly:
$ret_obj = $facebook->api('/me/feed', 'POST',
array(
'link' => 'Mylink',
'message' => 'Posting with the PHP SDK!',
But I need to attach the photo also. It works if photo is on the link I post, but I don't want that photo to appear on that page.
Is there any way?
Simply add a parameter, picture to while making the call-
array(
'link' => 'Mylink',
'message' => 'Posting with the PHP SDK!',
'picture' => '{image-link}'

How to auto publish on application's wall using PHP

I have requirement that whatever I store on server database (like adding new question), it should auto publish to application's wall so that users who likes application can see regular updates.
How is it possible using PHP?
Any answer would be appreciated.
Thanks in advance.
You have to set a listener that will read the new changes on db or from the interface where u are setting the data for the database call the fb api and post it inmediatly... in that case would be something like this.
$autpost = array('message' => ' message',
'name' => 'This is my demo',
'caption' => "Caption ",
'link' => 'http://facebook.com',
'description' => 'description',
'picture' => 'http://somesite.picture.jpg',
'actions' => array(array('name' => 'Get Search',
'link' => 'http://www.google.com'))
);
$result = $facebook->api('/fanpage id/feed/', 'post', $wall_post);

Facebook php sdk - post to a wall with prompt

T'm writing a Facebook canvas app, and I'm trying to post to the user's wall. this the code I'm using:
if ($user) {
$attachment = array('message' => 'This is message',
'name' => 'Name of the message',
'caption' => 'Caption of link',
'link' => 'http://www.example.com/about',
'description' => 'Great site!',
'picture' => 'http://lorempixum.com/100/100/',
'actions' => array(array('name' => 'Do Something!',
'link' => 'http://www.example.com'))
);
$result = $facebook->api('/me/feed/',
'post',
$attachment);
}
So I tested with 2 facebook accounts, and it posts to the wall but without the facebook dialog i'm always seeing. I would like the user to be warned that I'm gonna post on the wall, and allow him to cancel it.
How do I do that?
You need to use the JavaScript SDK, essentially the dialogs bit: http://developers.facebook.com/docs/reference/dialogs/feed/

facebook wall post no image

I am adding functionality to post to a visitors Facebook wall.
I am using the following code:
$path_to_image = "http://projects.kleelof.com/boot_designer/image_interchange.php?c=" . $file_id;
$attachment = array('message' => 'this is my message',
'name' => 'The name of your company',
'caption' => "Caption of the Post",
'link' => $path_to_image,
'picture' => $path_to_image,
'description' => 'this is a description',
'access_token' => $facebook->getAccessToken()
);
//echo($path_to_image);
$result = $facebook->api('/me/feed/','post',$attachment);
The post appears on my wall, but not the image.
You can see the full process and post it makes by trying the app at: http://projects.kleelof.com/boot_designer - Then select either one of the 2 links.
take care,
lee
I think the path to the image needs to be and actual file system path, and the image will be read and uploaded along with the request for FB to process. Also, it needs to start with a # to actually upload it.

Categories