Reputation: 1261
Hello I have a html page (twitter.html) with the following script
<script type="text/javascript" charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script>
<script type="text/javascript">
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
var TwitterCount = getParameterByName('TwitterCount');
var TwitterHandleName = getParameterByName('TwitterHandleName');
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: TwitterCount,
interval: 30000,
width: 272,
height: 'auto',
theme: {
shell: {
background: '#ffffff',
color: '#000000'
},
tweets: {
background: '#ffffff',
color: '#005A8C',
links: '#000000'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
behavior: 'all'
}
}).render().setUser(TwitterHandleName).start();
</script>
If I access the page
http://localhost/twitter.html?TwitterHandleName=billgates&TwitterCount=3
I am able to see the last 3 tweets.
What I want is to do an http posting on this page from my aspx page. Below code returns only the script tags etc instead of rendered html. My question is how to get the rendered html of a page?
HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create("http://localhost/twitter.html?TwitterHandleName=billgates&TwitterCount=3);
loHttp.Timeout = 30000;
loHttp.UserAgent = "Twitter";
HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
//Encoding enc = Encoding.GetEncoding(1252); // Windows default Code Page
StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream());
string htmlCode = loResponseStream.ReadToEnd();
loWebResponse.Close();
loResponseStream.Close();
Upvotes: 1
Views: 1915
Reputation: 3261
You can try to open that url into frame on your web page and get html from them using javascript.
Upvotes: 0
Reputation: 4990
I understand it's using a prebuilt javascript widget, but could you move it server-side using a twitter wrapper like https://github.com/danielcrenna/tweetsharp (available from NuGet) or http://linqtotwitter.codeplex.com/?
Upvotes: 1