using System;
using System.Text;
using System.Net;
using System.Collections.Generic;
namespace Woodpecker.Net.Http
{
///
/// Provides various functions for interacting with the internet via the HTTP protocol.
///
public class httpProvider
{
#region Fields
private Dictionary Parameters = new Dictionary();
#endregion
#region Methods
///
/// Adds a parameter to the request.
///
/// The parameter to add.
/// The value for this parameter.
public void addParameter(string Parameter, string Value)
{
if (Parameter.Length > 0)
this.Parameters.Add(Parameter, Value);
}
///
/// Processes the request at a certain URI.
///
/// The URI to process the request at.
public string getResponse(string URI)
{
int i = this.Parameters.Count;
if (i > 0)
{
int i2 = 0;
URI += "?";
foreach (string Parameter in this.Parameters.Keys)
{
i2++;
URI += Parameter + "=" + this.Parameters[Parameter];
if (i2 < i)
URI += "&";
}
}
try { return new WebClient().DownloadString(URI); }
catch { return ""; }
}
#endregion
}
}