Return to Snippet

Revision: 47690
at June 14, 2011 06:45 by serialk89


Initial Code
// DE La MANO CON LA D ABAJO
function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){
                FB.ui(
                {
                    method: 'stream.publish',
                    message: '',
                    attachment: {
                        name: name,
                        caption: '',
                        description: (description),
                        href: hrefLink
                    },
                    action_links: [
                    { text: hrefTitle, href: hrefLink }
                    ],
                    user_prompt_message: userPrompt
                },
                function(response) {

                });
            }

//PUBLICAR CON MENSAJE

            function publishStream(){
                streamPublish("Stream Publish", 'Thinkdiff.net is AWESOME. I just learned how to develop Iframe+Jquery+Ajax base facebook application development. ', 'Checkout the Tutorial', 'http://wp.me/pr3EW-sv', "Demo Facebook Application Tutorial");
            }

//PUBLICAR AUTOMATICAMENTE
            function auto_publishPost() {
                var publish = {
                    method: 'stream.publish',
                    message: 'is learning how to develop Facebook apps.',
                    picture : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/img/logo.gif',
                    link : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/',
                    name: 'This is my demo Facebook application (JS SDK)!',
                    caption: 'Caption of the Post',
                    description: 'It is fun to write Facebook App!',
                    actions : { name : 'Start Learning', link : 'http://www.takwing.idv.hk/tech/fb_dev/index.php'}
                };

                FB.api('/me/feed', 'POST', publish, function(response) {  
                    document.getElementById('confirmMsg').innerHTML = 
                    'A post had just been published into the stream on your wall.';
                });
            };  


// UPDATE ESTATUS 1
function updateStatus(){
                var status  =   document.getElementById('status').value;

                $.ajax({
                    type: "POST",
                    url: "<?php echo $fbconfig['baseUrl'];?>pb_ajax.php",
                    data: "status=" + status,
                    success: function(msg){
                        alert(msg);
                    },
                    error: function(msg){
                        alert(msg);
                    }
                });
            }

//UPDATE ESTATUS 2
            function updateStatusViaJavascriptAPICalling(){
                var status  =   document.getElementById('status').value;
                FB.api('/me/feed', 'post', { message: status }, function(response) {
                    if (!response || response.error) {
                        alert('Ha ocurrido un error');
                    } else {
                        alert('El estado se actualizo correctamente.');
                    }
                });
            }

Initial URL


Initial Description


Initial Title
FUNCIONES FACEBOOK, PUBLICAR EN EL MURO, ACTUALIZAR STATUS, AUTO PUBLISH

Initial Tags
api, facebook

Initial Language
JavaScript