tags:

views:

64

answers:

2

What I've seen: http://www.dapper.net/dapp-factory.jsp Dapper seems to have solved this problem. You can load any external site, and run javascript on it. I dont know how this is done. They are using proxy, as http://www.worldofwarcraft.com loads. Worldofwarcraft.com will detect any proxy and block it (i've tested this).

the proxy i am using:

MY PROXY:

GET /ip/headers HTTP/1.1
Host: www.ioerror.us
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip
Connection: close

dapper proxy:

GET /ip/headers HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12 (.NET CLR 3.5.30729) Dapper/0.6
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Host: www.ioerror.us

Another proxy that fails to load worldofwarcraft.com

GET /ip/headers HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
+1  A: 

You'll always be blocked by the same origin policy - if you weren't, then creating "man in the middle" style sites that use a full-page iframe to load, say, your bank would be easy. Even your www.dapper.net example is using proxies - the iframe created for www.worldofwarcraft.com is /ServerNavigator?factoryId=40042&namespace=top&url=http%3A%2F%2Fwww.worldofwarcraft.com

Adam Wright
question is what are they doing different that enables worldofwarcraft.com to load ?
likeafly39
file_get_contents("worldofwarcraft.com") loads it successfully. but how to render the JS and all that stuff ? its frustrating.
likeafly39
Their proxy is somewhat different to yours? I'd imagine it's passing through some headers that yours is not, probably with some level of rewriting to make things like cookies (mostly) work.
Adam Wright
added the difference in headers.
likeafly39
A: 

This is a fairly pointless repeat of your previous question. You may not want to accept it, but cross-site-scripting into a domain you do not control is disallowed for extremely good reasons.

They are certainly not using proxy

Yes, they are. Naturally to make relative links (to scripts or other resources) work you would have to parse the page and change all the hrefs/srcs/etc, or, easier, add/change the <base> tag. (Dapper makes many more changes than that.)

Proxies will never be the fastest, but if you are determined to show content from another site inside your own context it is the only game in town. You can improve performance by caching at your end; indeed it would be impolite not to. If web servers start to see your site pulling a lot of their bandwidth by proxying they are likely to block access from your IP.

bobince
yeah im convinced proxy's the only way to go.btw, i am curious as to why worldofwarcraft.com would block my proxy but not dapper's. i've added the difference in header outputs.
likeafly39
What do you get back? An error? You'd expect a 302 redirect as the first step, then a gzip-encoded response (do you actually handle gzip? Is that something done by whatever function you're calling to fetch the page?)
bobince