How can I pull in my BlogSpot page into a page on my web site - redirect

I have a blog on BlogSpot.com, and I have a domain based on my own name. I want to have a URL on my site (like http://www.mydomain.com/blog) that will then pull in the content from my blog page, but I want the URL in the address bar to stay on http://www.mydomain.com/blog, so that it does not look like you left my site.
(I have a Windows hosting account on 1and1.com)
I did Google this question, and I found how a few things, like:
1: Adding a tag in to "refresh". Tried this, but it changes the address bar.
<meta http-equiv="refresh" content="0; URL=http://myblog.blogspot.com" />
2: I also learned about the html iframe thing, but it has height and scrollbar issues.
3: Then, I found this partial code snippet, but I don't know what to do with it, or if it will even work against the BlogSpot server, or on my server:
<%
Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.Open "GET", "http://myblog.blogspot.com", false
objHTTP.Send
Response.Write objHTTP.ResponseText
%>
I am a client app guy, so this web stuff is all new to me.
Any help will be greatly appreciated.

The third option will probably work for the initial page load, but any links on the page will then direct the user to the BlogSpot page, and change the url. It simply fetches the page from blogspot, and then sends it to the user without any changes.
For me, the changing url is not a big deal, as long as it's easy for the user to get from one to the other easily; have prominent links on either page that tell the user where they go. Most people don't care about the url, they just care about the content.
Using an IFrame is probably your best bet. Many Facebook applications are in IFrames and still integrate very well.

I think using a regular frame or an iFrame is probably the easiest solution. What kind of scrollbar issues did you encounter? You can set custom values for some of these attributes, just check out the documentation here:
http://www.w3schools.com/TAGS/tag_iframe.asp
If you didn't want to use frames, you could actually proxy the entire page using a server side application like Squid. However, this is more difficult to setup, requires the ability to install software and configure firewall/iptable settings on your host, and must be configured properly to prevent malicious abuse.
-Mark

Here are some options you can try:
If you have PHP installed:
<?php
echo file_get_contents('http://myblog.blogspot.com'); // or you can use fopen()
?>
Or Server-Side-Includes installed:
<!--# include virtual="http://myblog.blogspot.com" -->

You can also pull blog content from Blogspot using the Blogger Data API.
The advantage of this is that you can reformat and reorganize the content to match the style of your website. The disadvantage is that it's more work than an iframe, and you probably won't match the full functionality of Blogspot.
I'm playing with this now to see whether I can use Blogspot as a type of CMS for a club news system.

Related

Is it possible to add adverts to a custom Facebook Page Tab app?

I need to create a custom Facebook Page Tab app which will show an external site in an iframe. This need to have adverts on it but I'm not sure if this is possible as the site is hosted externally.
I'm not sure if I need to sign up to the Facebook Audience Network to get approved etc. either?
Any help or advice would be great.
Many browsers have this limitation of not allowing external sites to be shown in an iframe. Imagine the case when you are working hard to create a site and others show all your content in iframes. That is, naturally frustrating.
However, there is a candidate-solution: Let's suppose you create a page which sends a request to the other site and appends all the content into the body and head of your page. This is very much possible, so the solution is to:
Create a page in your site, let's call it outsider
In the server-side code of your outsider page send a request to the desired page to be shown
You will get the html of the page. Process it and include its content into the head and body of outsider. This includes:
3.1. Checking all the CSS to be reached, as the target page might refer to local CSS, which is unreachable locally at your end. Process the URLs of CSS files
3.2. Checking all the Javascript to be reached, as the target page might refer to local JS, which is unreachable locally at your end. Process the URLs of JS files
3.3. Apply the idea described in 3.1. and 3.2. for other resources, like images, until you are satisfied with the content of outsider
Create an iframe, having the source to point to outsider. outsider is inside your scope, so it should be shown
NOTE: If the site owning the target page does not like the possibility of you showing their content inside iframes, they might protect it by, let's say, having Javascript in their code, which checks whether the page is inside an iframe. Remove that code while processing the response to your request. If nothing else prevents you from showing the page in an iframe, then you should achieve success.

How to secure querystring/POST details to a third party

I'm basically looking at a security problem between a parent page and an iframe with links to a third party.
I want to send a POST or a GET (doesn't matter which as I can control the other side) to the third party, but not expose any details within it (say a SID or a user token) and have it's HTML content (JS/HTML/Images) loaded into the iframe.
I've looked at server-side redirects, creating a proxy using webclinet/webresponse and am curious to whether there is a good way to do it.
Has anyone ever done this before, or think that the secrity is not possible? Hell, even if I'm barking up the wrong tree on how to solve this.
If anybody has any examples on this it would be greatly appreciated.
Cheers,
Jamie
[Edit] Was thinking I might need to add some more details.
Say I have a parent page: https://mycompany.com/ShowThirdParty.
This has an iframe in it at the moment which will have the content of another component (also owned by me, or another team more specifically)
Basically I'd like to send some credentials to content in the iframe in such a way that the external pages can't read it, the iframe is put into a modal (I've done that) and the iframe has the restricted content with the auhtentication almost seamless and invisible.
I currently have it working as a GET url generated dynamically via JS and then passed into the iframe src parameter, obviously that isn't secure.
I kind of want some kind of server side redirect across a full url, but I don't even think that's possible.
You could try using AJAX and load a PHP script (with any parameters to the script encoded/encrypted) to query the 3rd party page and load the response into the iframe. Not really sure how your code is setup but there should be a way.
It can also be done by POST Method (submit the data to iFrame using POST) as it is HTTPS so the data you send to iFrame is encryped.

Why does Object debugger say my URL is a facebook URL and isn't "scrapable"

In trying to create an "object" page for my first facebook app, I've run into some difficulty. I followed Facebook's Open Graph Tutorial nearly exactly.
After creating an "object" html page with the appropriate <meta property="og:... tags I tried running the URL through the Debugger Tool as suggested in the tutorial but I'm given the following error:
"Facebook URLs aren't scrapable by this Debugger. Try your own."
This page is in the same directory on my company's linux box as the canvas page, and is certainly not a "Facebook URL". If it matters, I'm using an IP instead of a domain name: xx.x.x.xxx/app/obj.html
...
I continued the tutorial anyway, but ultimately it does not seem to want to post a new action/object (is this even right?). I did however manage to get something to work, as in the app timeline view I apparently actioned one of those objects a couple hours ago. I assume this happened when I was pasting curl POST commands into the terminal.
I'm pretty new to the whole open graph, and facebook APIs, etc., so I'm probably operating under false assumptions of some sort, and I've been all over trying different things, but this error seems pretty bizarre to me and I can't seem to resolve it.
UPDATE
I just took the object page and put it on my own personal shared hosting acct. The debugger worked (inexplicably) fine on it, but I couldn't go too far since it's a different domain than the one authorized by my app.
Make sure og:url inside your html page does not point to facebook.
Also, make sure to look at the open graph protocol page (to see you formatted the og tags correctly.
Also, make sure the page is accessible to everyone, not just yourself.
Without knowing the URL it's hard to be sure, but it's most likely that your URL is either including a og:url tag pointing to a facebook.com address, or a HTTP 301/302 redirect to Facebook instead

Preserve Google +1, Facebook Like, and Twitter Tweet This button counts after URI change

My question is very simple: is there any way to (programmatically, technically, or manually) make a Google +1, Facebook Like, or Twitter Tweet This button preserve its count after a change of URI?
Programmatically: Doing something with the javascript to make it show the combined counts of two URIs while posting the new action to only the latter.
Technically: Do they detect and follow a 301 redirect from the original resource? Is there any special text I can include in the HTTP header to tell them that they should move all "points" from the old URI to the new one?
Manually: Some form somewhere on their site that I can submit or someone I can email that will be able to copy our points over to the new URI?
(note that I use URI and not URL in this question on purpose. The canonical resource link is changing from something.php?id=idnumber to /mycoolproduct/)
EDIT
Bounty started, but don't answer with "it can't be done"
I believe there is only one solution that fits your request above universally. That solution would be to 301/302 the old URIs to the new URIs and then keep using the old URIs with your social buttons. All the major social buttons allow you to specify the URL for which to like/g+/tweet/etc. This would preserve your existing social share counts and all shared posts would still direct to the same page. The choice now becomes whether to 301 or 302 redirect. A 302 may help preserve current search placement and avoid loosing your ranking if its pretty good. A 301 redirect (moved permanently) will cause search engines to start indexing your new URLs and dropping the old ones. This might cause a loss in current search rankings. It appears that as of this post, nobody is honoring redirects for social votes of any kind.
So I think the the safest route is to 302 redirect and continue to use the old URIs for social votes. You will keep your equity this way, but must maintain your redirects and become even more invested in the old URI template. How are your redirects implemented? .htaccess? or in page? You will need to weigh the cost-benefits for your case.
Otherwise you should probably 301 and start using the new URIs for your social buttons. In this case you might loose your social equity, but are free to build new without fear of messing up anything. If the social equity you are replacing can be recouped in say 6 months or less I wouldn't bother with it and start fresh.
However, this brings up an interesting point. You mentioned programatically adding two counts. Well yes, you could put together some JavaScript to add a couple counts together, but I gotta ask why? Adding them together for visual display purposes will not actually help increase referral traffic or search ranking. So its just a facade that I don't think helps you. If you're just looking to fool your visitors into thinking you're popular, why not just generate an image server side that keeps counting up. (bad joke, don't do it!) Bottom line you can't actually redirect your social equity, you may be able to pretend to have moved it, but you can't actually.
Considering your original question asks about several social buttons, its important to note that even if one or two of these services started honoring redirects when applying social votes, it wouldn't relieve you from making the decisions above. You'll still need the redirects for existing backlinks, and if you are supporting multiple social buttons on your page the choice of redirect type will need to be made with all of the social buttons in mind.
I can't speak for how to do this with Twitter/G+ but for Facebook:
You can't 'move' the likes and comments between URLs, and for new content you should definitely start using the new URLs, but for your existing URLs you can still have the original like counts/comments work if you:
Continue pointing the Like button on the new URL to the old URL (i.e <fb:like url="http://oldurl"/>
Add an exception to your redirect code so that when Facebook's crawler (facebookexternalhit/1.* - currently 1.1) accesses it, the original set of open graph meta tags are displayed (this will keep the description, title, thumbnail, etc, working as before)
Other users that land on the 'old' URL will still be redirected to the content in its new location
I have a real solution to this problem it might not be the most conventional but it does work 100%. Using a simple jQuery plugin called sharrre. Keep in mind I'm not the best jQuery coder (If you see improvements please let me know!) but this works regardless.
Here is how I did it on my site:
Using the sharrre plugin you can add the current share count to any element on your page. I simply got the data for both URLs then added them together and displayed them on the like, tweet, share, etc buttons.
This example is with Twitter but I'm doing this with Facebook, Google Plus, Pinterest and Linkedin. Here is the code:
<li id="twitter" data-url="CURRENT-URL" class="twitter sharrre"></li>
<li id="twitter-old" data-url="OLD-URL" class="twitter sharrre" style="display: none;"></li>
Then I called sharrre's code:
$(function(){ sharrreItUp(); }
This is how my function looks on my .js file:
function sharrreItUp() {
$('#twitter').sharrre({
share: {
twitter: true
},
enableHover: false,
click: function(api, options){
api.simulateClick();
api.openPopup('twitter');
}
});
$('#twitter-old').sharrre({
share: {
twitter: true
}
});
setTimeout(function(){
var oldTwts = $('#twitter-old .box .count').html();
var newTwts = $('#twitter .box .count').html();
$('#twitter .box .count').html(parseInt(oldTwts) + parseInt(newTwts));
}, 2000);
}
And BAM... you have your new URL being sharrred and the old shares from different social networks get added into them.
Unfortunately, there is no solution for this. We have tried all possible solutions and you will simply lose your social equity if you do a 301 Redirect. We found it to not be worth the hassle of trying to maintain our vote counts, and have instead pointed our buttons to the homepage in the interim of moving to the new url structure.
demo: http://so.devilmaycode.it/preserve-google-1-facebook-like-and-twitter-tweet-this-button-counts-after-ur/
i don't wanna say something wrong, but i think you just need to define the URI inside each share button, so no matter from what URL the vote come from, the defined url will be used as count.
if you, instead already have two different sources and you want to join it, you should follow the iframe src and scrape the count from it; for google +1 the div id that contain the count is #aggregateCount for twitter is #count; an example could be as below:
<?php
$doc = new DOMDocument();
$doc->loadHTMLFile('iframe-url-goes-here');
$count = $doc->getElementById('aggregateCount');
echo $count->nodeValue;
?>
then, on your page after the DOM is loaded and the widget are loaded, you can append your own value.
hope this help, in anycase i prefer the first way.
Put in the head of the new page
<meta property="og:url" content="old_url_here"/>
This way Facebook attributes likes for the old page. The only downside is that this way when people share your link, the old rich snippet will be included.

Facebook Iframe App with multiple pages in Safari Session Variables not persisting

I have a facebook Iframe application with multiple PHP pages in it.
I have some links that point relatively to the files inside my "iframe folder".
Having some issues with session variables inside the iframe. I set some session variables but they do not persist from one page to another.
This does work on other browsers.
I've been reading that Safari does not support Cross-Domain cookies and this might be the problem , but im not sure how to fix this.
Any help?
I believe this solution has become obsolete with the latest (6.0 and later) versions of Safari.
Safari by default does not allow cookies to be set from third parties. This affects Facebook iframe applications because the user is accessing a page served from apps.facebook.com but the iframe is being served from yourdomain.com, the "third party" in this case.
There are several several solutions mentioned around the web. The best I've found and one recommended by Facebook in its list of miscellaneous issues is to fake a POST request to yourdomain.com using JQuery. This solution detailed by Anant Garg works in general for different host/iframe domains and needs to be adapted for Facebook apps. The key parts are:
$("body").append('
<iframe id="sessionframe" name="sessionframe" onload="submitSessionForm()" src="http://www.yourdomain.com/blank.php" style="display:none;"></iframe>
<form id="sessionform" enctype="application/x-www-form-urlencoded"
action="http://www.yourdomain.com/startsession.php"
target="sessionframe" method="post"></form>');
var firstTimeSession = 0;
function submitSessionForm() {
if (firstTimeSession == 0) {
firstTimeSession = 1;
$("#sessionform").submit();
}
}
Another solution by Will Henderson is to instrument each link on your page with session information using a Javascript function. Then modify your server code to capture this session information by reading it from GET parameters.
I wrote the blog post Dominic refers to in his answer.
The problem is that the default behavior of Safari is to only accept cookies from sites that you visit. This excludes "third party" cookies. Safari treats the page inside an IFRAME as a third-party site, and until you interact with that content (by clicking a link, for example), it will refuse those cookies.
Your PHP code needs to set a cookie on the first page that uses the session in order for that session to persist from one page to another, but if the session variables are in the very first page in the IFRAME, you have a chicken-and-egg problem.
My solution is to retain all of the special Facebook parameters through to the second page loaded into the IFRAME. Because you've interacted with it, cookies set on the second page will persist, and this allows your PHP code to keep whatever state it needs to communicate back to Facebook.
This won't likely help your PHP session, though, so I suggest adding another parameter to links on the first page that allows the second page to look the session up, or otherwise recreate it.
I think the best solution is to manually keep track of the session ID i.e. by using session_id($_GET['session]); Just make sure you do this before calling session_start(); and everything works.
Safari accepts cookies only from the page the user navigates to. The easiest and most effective way to fix this is to redirect the request from landing page of your canvas app to a different page on your domain using top.location.href and redirect the user back to the canvas app from that page.
For example, if abc.php is your landing page and the canvas URL is facebook.com/abc. First redirect the request from abc.php to a different page like xyz.php then redirect again from xyz.php to facebook.com/abc. Don't forget to start the session in xyz.php.
This is the simple fix...
and thanks for all the input. I ended up solving the problem by appending the "signed_request" paramter on every page. I just put it in as a hidden field and set it in the code behind. That way I managed to get it to work in Safari. Hope it works for you too.
With the release of Safari 7, not only 3rd Party cookie is being blocked. Local Storage as well as WebDB, any kind of website data are being blocked. When you go to Safari Preferences (CMD+comma), Under privacy tab, on Safari 7, it now says : "Block cookies and other website", originally was "Block cookies". That confirms the changes.
Other browsers might follow through in the future. Most probably Firefox. Chrome, cough *cough* probably not.
You probably have to employ some workaround using redirection technique or popup similar to what disqus did.
If you using .NET then there is a much simpler solution to this problem.
Just set cookieless to false in your web.config. Ex:
sessionState mode="InProc" cookieless="true" timeout="60"
Its a lot easier than posting an iframe, or opening a popup window with the url of the iframe.
kind regards,
David
I used this header with PHP, that fix my problems
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');