I've searched quite thouroughly but can't find a proper answer so here I am, asking support for the first time about this API.
I am using Zend Framework to develop a mobile web application that also integrates a part of Facebook. So I started digging into the Facebook PHP SDK, and got my url and library working. The one problem I come across is that when Facebook acknowledges the login, it redirects with the known blabla.bla/?blabla= get parameters. Zend Framework however operates by using Url Rewrite, so these two collide.
I can't find an option for Facebook to use an Url Rewrite friendly response, is there a way to get Facebook to do this for me, or am I supposed to create a stand alone response page to redirect the proper Url Rewrite?
Best regards,
Casper
There is no such a thing as URL "friendly option", if you are having problems, it has to be with the URL that you are giving Facebook for the redirect, and the method you are using to get the variable content.
Zend framework can work with variables sent using "pretty" URLs, or normal requests, you can use the zend version that is something like this:
$this->getRequest()->getParam('your_param_name');
Or the normal one
$_GET["your_param_name"]
In you action and it will work just fine.
Take a look at the complete documentation here:
http://framework.zend.com/manual/en/zend.controller.request.html
Related
I have developed REST API in core php. This APIs are used in mobile app to fetch data from server.
Now we have a situation where 10000 users are using the app at the same time. When all this users are on app at same time, the server(Amazon EC2 UBUNTU 12.04) fails.
In order to solve this, we have decided to use CloudFlare. After lot of research, it is still not clear how to use cloudflare to cache the response coming from APIs.
Below are few links that I have followed so far:
https://support.cloudflare.com/hc/en-us/articles/202775670-How-Do-I-Tell-Cloudflare-What-to-Cache-
https://blog.cloudflare.com/introducing-pagerules-advanced-caching/ .
We have already set CNAME and HOST details on our CloudFlare account. Can someone help me to know what implementation is needed. Or if this is possible at all or no?
After a lot of research, I found that it is possible to cache the response of REST API. We just need to create a custom page rule.
Just in case someone else is facing the same issue then follow below steps:
1) Get the domain name for your URL. For example, if your API URL is http://xx.xx.xx.xx then you need to get a domain and link it so that your API URL can be http://domainname/...
2) Since the data is not HTML content or CSS, you should create a custom page rule. It is detailed very nicely by cloud flare but is hard to find the link. SO here is the link for the same: https://support.cloudflare.com/hc/en-us/articles/115000150272-How-do-I-use-Cache-Everything-with-Cloudflare-
The entire setup with Cloudflare is done and the performance of my server has improved drastically. We just need to follow the steps carefully!!!
I am taking over a community website that was built using Kentico (an ASP.NET-based CMS).
I have PHP/CodeIgniter code that could add interesting functionality to this Kentico website. For example, my PHP code allows for uploading and posting of user-generated material such as images, which the community can then comment on.
Since I'm unfamiliar with how Kentico works, I wonder if anyone knows if this functionality exists in it (as a module). If not, either this
would have to be coded in ASP.NET or
I could have a hybrid website using my PHP code, however authentication from the Kentico side would have to be passed the PHP side of the website.
Any suggestions on how to handle this situation?
You can store the authenticated session in the DB where both ASP and PHP have access
Look into the "User contributions module" - if you've got access to a new enough version of Kentico and the appropriate license then it will probably do exactly what you need it to.
Otherwise if you needed to do authentication from a seperate PHP app, I suppose you could write a simple web service in .Net and add it into the Kentico site. In the past I've used a .ashx generic handler to do this.
Maybe you could include a hidden iframe to the other site on each page and use postMessage in JavaScript to send a session ID between the sites.
I would probably try to keep everything all in one code base unless there was reason to break it out into a seperate module though - otherwise it just seems like a lot of extra work.
I'm working on using the Etsy API and have been trying to complete this online tutorial but haven't been able to load any of the data successfully:
http://www.onextrapixel.com/2012/10/01/custom-products-webpage-layout-via-the-etsy-api/
When I load the page, it creates the cache file but the page is blank.
This is my first venture into APIs and I'm not sure how to troubleshoot what the problem might be. It seems like all of the code with loading it into the PHP webpage should work ok.
I've read about a few issues people have had using the Etsy API beacuse of the json cross-domain policy, so I'm wondering if that might be the issue, or if there might be authentication that is required.
I created a pastebin of the code from the tutorial here:
http://pastebin.com/RVDzjG4B
After checking the docs and the API, I got this.
API requests must be made over HTTPS.
Change your links to use https://.
Good day!
I have a PHP based web application, that I am looking to add a Wordpress to.
The main application is in the root folder, and wordpress is installed in /wp
In order to get WP content into my application, I am using a JSON API (http://wordpress.org/plugins/json-api/)
Then, from the application, I am calling the API with CURL.
Is this a good way to go about calling the API? CURL seems to be very slow, and I think it has something to do with sessions, and the fact that it is requesting a url on the same domain.
Or perhaps someone could offer a suggestion on a better way to go about getting wordpress content into a non-wordpress based application.
Thanks for the help!
thanks for reading! Here's what I'm up to.
I'm writing a WordPress plugin that makes use of the PHP SDK (latest version 3.1.1) that Facebook provides. My application is registered with Facebook as a website because it infact acts like a website, even though it's embedded in WordPress.
This SDK comes with an example.php that is very straightforward and easy to understand. If I put this file on my server, it just works. I made sure that the certificate file and the SDK files are in the right place and accessible by the script.
However, if I do the exact same thing from within a WordPress plugin (from the admin page of the plugin), the Facebook backend won't return the user id but will always return 0 instead. The problem with FB returning 0 is pretty common, but the reasons for it seem to vary a lot.
I have to mention that this behavior wasn't always like this. It began just a few weeks ago. I'm suspecting that the FB backend somehow checks for indirect API calls and that calling it from within a WordPress plugin seems to violate FBs auth rules in some way (CSRF issue?). But I'm not sure.
Has anybody got a clue what's going on here?
Here's my guess:
Facebook will not be able to access the backend of your WordPress blog since it requires authentication. So the example.php code will not be visible to it from a WordPress admin panel.
When served raw on your server, there are no such access controls and Facebook is able to reach the page.
If this is the case, my suggestion would be to turn this into a non-admin plugin, perhaps by adding a rewrite rule using the WP_Rewrite class.