Success or Error XFBML response to Facebook Page Plugin

90 Views Asked by At

https://developers.facebook.com/docs/plugins/page-plugin

I have a very basic piece of code (below) that allows you to type in a box and display the results of the Facebook page plugin trying to fetch a page plugin for a specific URL.

I'm trying to get the response that is rendered by the plugin only there's not an error, but am not sure how to access this information. For example, I could type "abc" into the box, it'll try to pass in "abc" instead of a valid Facebook URL, and the page plugin will give an XFBML response "Error: Not a valid Facebook Page url."

Does anyone know if there's a way to capture a successful returned result from this plugin code?

The end-game is to store the URL in a database for each client of ours, but only if its valid.

<cfform action="#SCRIPT_NAME#" method="post">
    <label for="fbUrl">Facebook URL</label>
    <cfinput type="text" name="fbUrl">
    <input type="submit" name="Submit" value="Submit" />
</cfform>

<cfif isDefined("Form.fbURL")> <!--- If the FB Url is defined in the form --->
    <div class="fb-page" data-href="<cfoutput>#fbUrl#</cfoutput>" 
                     data-tabs="timeline" 
                     data-small-header="false" 
                     data-adapt-container-width="true" 
                     data-hide-cover="false" 
                     data-show-facepile="true">

        <div class="fb-xfbml-parse-ignore">
            <blockquote cite="<cfoutput>#fbUrl#</cfoutput>">
                <cfoutput><a href="#fbUrl#"></a></cfoutput>
            </blockquote>
        </div>
    </div>

<!--- if the plugin doesn't return some error,
      save the facebook URL in the clients database --->
</cfif>
0

There are 0 best solutions below