The idea is simple. Find right APIs and use them to change or add HTTP header fields for specific purpose.
Like in Android:
DefaultHttpClient httpClient = new DefaultHttpClient();
httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "iTunes-AppleTV/5.1 (3; 8GB; dt:12)");
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("X-Apple-Store-Front", "143463-18,18A");
httpPost.setHeader("X-Apple-TV-Resolution", "1080");
httpPost.setHeader("X-Apple-TV-Version", "5.1");
HttpResponse httpResponse = httpClient.execute(httpPost);
The problems lie on Javascript script tag. It's much easier to do this for XMLHttpRequest() because there're some corresponding APIS to use from, but when it comes to script tag, I can't find a solution online for this as to now.
Reference links
http://stackoverflow.com/questions/7092252/how-to-set-header-using-http-post-method
http://stackoverflow.com/questions/2533236/setting-user-agent-in-java-httpclient-and-allow-redirects-to-true
http://stackoverflow.com/questions/4866722/is-it-possible-to-set-custom-headers-on-js-script-requests
沒有留言:
張貼留言