Determine if request came through a Facebook page tab - php

If the user visits foobar.com through a Facebook page tab I'd like to show them specific data.
However, if the user goes directly to foobar.com I'd like to show something different.
I've not been able to come up with one good method to do so.

Check out signed_request which is sent to each page loaded in a Facebook tab.
if (isset($signed_request['page'])) {
// I'm in a tab
}

Related

Communicating between a page and a popup oauth page

I have an application that has a button which opens a blank page for linkedin oauthentication.
My question is, when the user completes authentication and processing for linkedin, how do I tell the original page that this process is complete?
I was thinking about creating an ajax method that tells the database that the user is in oauth and when they are complete we tell the same database that the process is over and the original page will find out.
Any ideas?
See: How can I do OAuth request by open new window, instead of redirect user from current page?
The trick is the window.opener property, available from the popup. Using that you could do something simple like a reload window.opener.location.reload() or possibly something more complicated using postMessage (in either case the code would live in the page that OAuth redirects to on completion).

How can I get Infusionsoft's Cookie Info from this URL

Infusionsoft provides the following script / method of obtaining an affiliate ID. Now, I want to call that URL programmatically and just get back the affiliate ID - I don't want to redirect or go anywhere else, I just want the affiliate ID to use in a following query. I know there has to be a way to do this, but I have no idea what it might be...
--
Here is an example of the modified redirect link URL. You will need to change highlighted sections to enter your Infusionsoft application name and the URL of your destination website.
https://appName.infusionsoft.com/aff.html?to=http://www.example.com
If the prospect clicking on this link has a referral cookie stored on their browser, the partner will land on a page with a URL something like this:
http://www.example.com?affiliate=1234
The destination URL matches the one at the end of the redirect link and the referring partner's ID is part of the URL. If no cookie is found, the referral partner ID number is set to zero.
I think I've looked into doing this before. It seems to me that if you created a page to redirect to, for example, http://www.example.com/affiliateId.php, and on that page you echoed nothing but the affiliate ID, like so:
<?php echo $_GET['affiliate']; ?>
You could simply cURL that page and pull in the response. The problem here is that when you cURL the page, it's actually your server going to the page, and not the user's computer, so it always returns 0.
So, somehow, you need to get the user's computer to navigate to the page, perhaps through the use of an iframe or an ajax call and then pull the information after it's been rendered using a client side script.

Facebook Page Tab does not forward

I implemented a Facebook Like Status Request on my Page Tab but if I want to click on the "next"-Link (to see index.php?action=step2) it loads the page that pops up if Like Status = Not Like. If I want to link to http://www.google.de the Page Tab doesn't load any page at all. What am I doing wrong?
I'm assuming you're detecting if the user likes your page or not via the signed_request parameter POSTed to your app's page
If so, any links the user clicks inside the iFrame containing your app will be GET requests to a different URL which will not contain the signed request with the like data - you'll need to use your own mechanism (e.g. cookies, url parameters) to pass the 'like' information from the first to second page of your app

how to setup redirects based on referrer for individual wordpress post in a wordpress blog

hello everyone newbie here. i would like to set up a referrer redirect for my word press blog like this. i only want people refereed from a particular link like example.com/444 to have access to that post without being redirected . the rest traffic i would like to send them back to example.com/444
so to summarize
visitors from example.com/444 goes to post no action needed
visitors from other othersites.com goes to post i would like to redirect them after a set time to example.com/444
also i would like the redirect command to eliminate the back or undo action as if the traffic click back button in the browser they will return back to my post and will be referred from example.com.
example.com contains a set of actions the user has to complete in order to gain access to my post. after completing those action the user will be redirected to the post
i just want them to be redirected to my post only after completing the instruction on example.com
thanks you for listening
I just wanted to remind you that basing on referrers is really bad idea. People can just strip them (some antiviruses do that) or even use plugin that is doing that.

PHP, Zend Framework: How to fetch a page from another server, then deliver the content?

I think this might also be referred to as "scraping". Basically, what I want to do, is if someone clicks this link:
Click here
I want my links controller, display action to:
find the actual url of link #47 from the database (i.e. http://www.google.com),
fetch/scrape the content,
display the content in the browser as if it came from my application.
I want the browser window to display http://myapp.com/links/display/id/47 as the location in the browser window. That way, if a user (who has not been authenticated) requests to view this page, they will be sent to the login screen.
For more information on why I would want to do this, refer to this question.
Zend_Http_Client, send request, get response :)

Categories