I'm using CurlSharp library to GET HTTP. This is the code I got at the moment:
static void Main(string[] args)
{
Curl.GlobalInit(CurlInitFlag.All);
using (var easy = new CurlEasy())
{
easy.Url = "http://stackoverflow.com/";
easy.FollowLocation = true;
easy.WriteData = null;
easy.WriteFunction = OnWriteData;
easy.Perform();
}
}
public static Int32 OnWriteData(Byte[] buf, Int32 size, Int32 nmemb, Object extraData)
{
Console.Write(System.Text.Encoding.UTF8.GetString(buf));
return size * nmemb;
}
But OnWriteData()
is call many times. Is it possible to append buf
in string to get all HTML content ?