PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, February 6, 2022

[FIXED] Facebook - Posting .swf to user's wall with PHP SDK

 February 06, 2022     facebook, facebook-graph-api, facebook-php-sdk, flash, php     No comments   

Issue

I used to do this using the stream.publish method, where I specified the source file for my .swf along with other parameters to present the media, but this is now deprecated. How can I do this using the Graph API? Specifically the Facebook PHP SDK.


Solution

With the php sdk, you can post them like this:

$facebook->api('/me/feed', 'post', array(
    'type'=>'video',
    'source'=>'http://www.hackerdude.com/channels-test/swfscout_VideoSample.swf',
    'picture'=> 'http://fbrell.com/f8.jpg',
    'name'=> 'Facebook Dialogs',
    'caption'=> 'Reference',
    'description'=> 'Using Dialogs to interact with users.',
);

You should be able to add the link attribute to the mix, but there seem to be a bug in facebook's api at this moment that make the posts with link in it prevent embedding the swf. this way it will be embedded but the name in the resulting post will point to the swf file which is not good. Same values with link posted with the FB.ui from the js sdk doesn't exhibit this behavior.

One workaround could be to create links with the proper opengraph meta tags, and post that as type => 'link'.

the html file (video brought to you by youtube)

<html>
<head>
    <title>Fly, you fools!</title>
    <meta property="og:title" content="Fly, you fools!" />
    <meta property="og:type" content="website"/>
    <meta property="og:description" content="Content for Description" />
    <meta property="og:image" content="http://i2.ytimg.com/vi/meOCdyS7ORE/mqdefault.jpg" />
    <meta property="og:site_name" content="Content for caption"/>
    <meta property="og:video" content="http://www.youtube.com/v/meOCdyS7ORE?version=3&autohide=1">
    <meta property="og:video:type" content="application/x-shockwave-flash">
    <meta property="og:video:width" content="640">
    <meta property="og:video:height" content="360">
</head>
<body>
<script>
    window.location = 'http://disney.com'; // redirecting users who's clicking on the link, wont affect crawlers since its in js.
</script>
</body>
</html>

php sdk call to share it

$this->facebook->api('/me/feed', 'post', array(
    'type' => 'link',
    'link' => 'http://.../', // put the html file's location here
));


Answered By - complex857
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing