Adding Quesry string to Facebook fan page app - php

I have integrated a e-commerce site in my facebook fan page via page tab
https://www.facebook.com/Thesoftwareguy7/app_687345671301257
the problem it I want too append some custom url to it
https://www.facebook.com/Thesoftwareguy7/app_687345671301257?f=1
but when I parse the URL it gives me
Array ( [scheme] => https [host] => s-static.ak.facebook.com [path] => /platform/page_proxy/hv09mZVdEP8.js )
It worked perfectly in facebook apps when i append it in apps.facebook.com/687345671301257/
But it does not work in facebook fanpage custom tab.
Thanks for your time?

Did you have a look at the app_data field in the signed_request? The docs are here: https://developers.facebook.com/docs/appsonfacebook/pagetabs/#integrating
This would result in a Page Tab URL of https://www.facebook.com/Thesoftwareguy7/app_687345671301257?app_data=f%3D1
You then have to decode the app_data parameter to get the key/value.

Related

How to pass link directly for my fb fan page using fb api

I have used link attribute under api() array and tried giving that link directly but somehow it is ot working showing 404 page not found error. Can we display iframe directly for fb fan page. Imean whichever iframe code we will send that should get displayed on fb page
below is the code i am using writing on fb page
$facebook->api(
"/".$this->data['pageid']."/tabs/app_".$this->data['selectmyid'],
"post",
array(
"access_token" => $pageAccessToken,
"custom_image_url" => "http://socialmobiapps.com/members/publishing-option/images/pagetab.png",
"link" => "http://linkconnect.me/published_deals/134/",
"custom_name" => $name1
)
);

WP JSON API Connect

i want to post content to wordpress from other php app. i am using rest api plugin for posting and for authentication i am using oath plugin.i just want to know how to get the access token .i am referring
https://github.com/WebDevStudios/WDS-WP-JSON-API-Connect
for the json_url in the code i use
eg(http://myproject.info/wpsingle/wp-content/plugins/my_plugin/json-rest-api/lib/wp-json.php)
ends up in error.
[errors] => Array ( [wp_json_api_connection_failed_error] => Array (
[0] => There was a problem connecting to the API URL specified. ) )
[error_data] => Array ( )
I used this for the same thing. I used basic authentication. i.e. admin panel username and password for authentication. Because I was the only person who was going to post to wordpress. And the correct URL to access end point was like below
http://domain.com/wp-json/posts?filter[s]=awesome
this is the link to how to create a post. I used Guzzle to call api like below to get a posts from particular category.
$client = new \GuzzleHttp\Client();
$response = $client->get("http://domain.com/wp-json/posts?filter[category_name]=test", array('auth' => ['username','password']));
$posts = $response->json();
But, If you are going to let other people post than you must use OAuth. Because you can not share admin panel username and password with everyone.

What string should I pass to the Graph API to post a message with link and image?

The documentation for posting a link to a Facebook page has me stumped at this point:
picture Determines the preview image associated with the link. string
I've tried passing a valid URL and a base_64 encoded image, to no avail. Passing a URL results in the link posting without the image, but without returning any errors. This is what I'm passing in that case, as printed by PHP's print_r():
Array
(
[link] => http://mysite.cl/etc.etc.html
[name] => test name
[description] => test description
[caption] => test caption
[access_token] => [my_access_token]
[picture] => http://mysite.cl/app/site/artic/20140909/imag/foto_0000000120140909171931.jpg
)
Passing a base_64 encoded image results in an API error:
(#100) picture URL is not properly formatted
What should be the content of the picture field?
After checking some more, I've gathered that posting a complete URL like I am doing is right, but there's an open bug with facebook's safe_image script, the script that caches posted media, and it results in a 1x1px picture. Other questions in the same vein in SO include this one.

WooCommerce RestFul API URL showing 404 Error

I have the Restful settings enabled on the settings page and I have create a user with access keys.
I am using the PHP library and im getting this reponse.
stdClass Object
(
[errors] => Array
(
[0] => stdClass Object
(
[code] => 404
[message] => cURL HTTP error 404
)
)
)
If i visit the url in the browser /wc-api/v1 I also get a 404 response. I have seen some mentions of changing Permalink structure but it doesn't say what too anywhere?
Any pointers? Greatly received :)
Ok so they settings I need were...
Post name http://www.dipdye.co.uk/sample-post/
and
Shop base with category http://www.dipdye.co.uk/shop/product-category/sample-product/
After further reading it seems any 'pretty' url will work, my main issue was it not updating my Web.config file (as Im on IIS) on Apache this would be the .htaccess file.
I can now see something when i visit the page in web browser.
Hope this help someone else too.

Cannot access Facebook signed_request with an iframe tab

I've got an iframe loading in a facebook tab on a fan page and I'm not having any luck accessing the $_REQUEST["signed_request"] object. I'm confused because this is supposed to be a freebie and easily accessible. I've read and re-read the facebook docs and rechecked my facebook application settings but nothing is working.
isset($_REQUEST['signed_request']
is always false. Since I'm using the Facebook PHP sdk I've also tried
$facebook->getSignedRequest();
I've done print_r on the $_REQUEST and I don't see the signed_request in there. When I print_f the $facebook object, I see that the signedRequest is empty
[appId:protected] => XXX
[apiSecret:protected] => XXXXXXXXXXXXXXXXXXXX
[session:protected] => Array
[access_token] => XXXXXXXXXX|2.h75WqKxcA1xbNPufFvpKQQ__.3600.1304452800.1-726960374|JiO0ZS30SyLaApeqhMtdocK8B_Y
[base_domain] => XXXXXXXXX
[expires] => 1304452800
[secret] => rDF9C_z43_EUFy0Q_e6tyQ__
[session_key] => 2.h75WqKxcA1xbNPufFvpKQQ__.3600.1304452800.1-726960374
[sig] => 1971ef7eb8057c7404eae1f82d770ab5
[uid] => XXXXXXXXXXXXXXX
[signedRequest:protected] =>
[sessionLoaded:protected] => 1
[cookieSupport:protected] => 1
[baseDomain:protected] =>
[fileUploadSupport:protected] =>
[EDIT]
I do have the OAuth 2.0 setting enabled for the application.
OK, just had this on problem myself and found the issue.
Make sure that you do not have a 301 redirect on the canvas or tab page. In my case I set the app up as "mydomain.com/facebook/tab/" but my site was doing a 301 to "www.mydomain.com/facebook/tab/"
The content would show, bit the 301 caused the signedRequest to be null.
Added "www" to my domain in the app settings and the signedRequest now contains the data I was looking for.
I just had this problem. Finally figured it out. I had to add a forward slash to the end of my Tab URLs in the application settings on the Basic tab.
Instead of:
http://domain.com/facebook
I needed:
http://domain.com/facebook/
I had the same problem And I resolve it.
It's a problem with the URLS. Be sure that your
App Domain & Page Tab URL match the same domain for example:
1) App domain: example.com
Page Tab URL: example.com
will work
2) App domain: example.com
Page Tab URL: example.com/app/
will work
3) App domain: fb.example.com
Page Tab URL: fb.example.com/app/
will work
4) App domain: fb.example.com
Page Tab URL: example.com/fb
will not work
After some investigation, I suspect this has something to do with where the iframe source is hosted.
When I moved everything to localhost, the signed_request started coming in fine.
Edit the settings of your tab application.
On "Advanced" tab, make sure "OAuth 2.0 for Canvas" is enabled.
it's an old question but I found this with google...
the problem for me was that I did a manual redirect to the https url of my pagetab and than the $_POST['signed_request'] got lost

Categories