Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
*** скрытое содержание ***
PS посмотрел на сервис, очень похоже на тупой пиар нового сайта =)
тогда напиши что ты хотел
я так понял -- тебе нужна прораммная загрузка изображений на хост
а какой смысл создавать велисипет, а именно, собирать запрос вручную, если можно используя стандартные средства curl делать тоже самое и меньшим количеством строк в том числе
string sLogin = "************";
string sPassword = "************";
string link = @"http://image2you.ru/login/";
HttpWebRequest myHttpWebRequest = (HttpWebRequest)HttpWebRequest.Create(link);
myHttpWebRequest.UserAgent = "Opera/9.80 (Windows NT 6.1; U; en) Presto/2.2.15 Version/10.01";
myHttpWebRequest.Accept = "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1";
myHttpWebRequest.Headers.Add("Accept-Language", "ru-RU,ru;q=0.9,en;q=0.8");
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
string sCookies = "";
if (!String.IsNullOrEmpty(myHttpWebResponse.Headers["Set-Cookie"]))
{
sCookies = myHttpWebResponse.Headers["Set-Cookie"];
}
myHttpWebRequest = (HttpWebRequest)HttpWebRequest.Create(link);
myHttpWebRequest.Method = "POST"; // метод POST
myHttpWebRequest.Referer = link;
myHttpWebRequest.UserAgent = "Opera/9.80 (Windows NT 6.1; U; en) Presto/2.2.15 Version/10.01";
myHttpWebRequest.Accept = "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1";
myHttpWebRequest.Headers.Add("Accept-Language", "ru-RU,ru;q=0.9,en;q=0.8");
myHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
// передаем куки, полученные в предыдущем запросе
if (!String.IsNullOrEmpty(sCookies))
{
myHttpWebRequest.Headers.Add(HttpRequestHeader.Cookie, sCookies);
}
// ставим False, чтобы при получении кода 302 не делать автоматический редирект
myHttpWebRequest.AllowAutoRedirect = true;
string sQueryString = "email=" + sLogin + "&pass=" + sPassword + "&imageField.x=29&imageField.y=15";
byte[] ByteArr = System.Text.Encoding.GetEncoding(1251).GetBytes(sQueryString);
myHttpWebRequest.ContentLength = ByteArr.Length;
myHttpWebRequest.GetRequestStream().Write(ByteArr, 0, ByteArr.Length);
// выполняем запрос
myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
// выводим результат в консоль
string eeeeee = new StreamReader(myHttpWebResponse.GetResponseStream(), Encoding.GetEncoding(1251)).ReadToEnd();
myHttpWebRequest = (HttpWebRequest)HttpWebRequest.Create("http://image2you.ru/cabinet/upload/");
myHttpWebRequest.UserAgent = "Opera/9.80 (Windows NT 6.1; U; en) Presto/2.2.15 Version/10.01";
myHttpWebRequest.Accept = "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1";
myHttpWebRequest.Headers.Add("Accept-Language", "ru-RU,ru;q=0.9,en;q=0.8");
// передаем куки, полученные в предыдущем запросе
if (!String.IsNullOrEmpty(sCookies))
{
myHttpWebRequest.Headers.Add(HttpRequestHeader.Cookie, sCookies);
}
myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
eeeeee = new StreamReader(myHttpWebResponse.GetResponseStream(), Encoding.GetEncoding(1251)).ReadToEnd();
string uploadfile = @"F:\tempjob\get_content\picks\32918.png";
//NameValueCollection querystring = new NameValueCollection();
//querystring.Add("image_name", "loolllo");
//querystring.Add("Submit", "Загрузить на сервер");
//WebClient up = new WebClient();
//up.Headers.Add(HttpRequestHeader.Cookie, sCookies);
//up.QueryString = querystring;
//up.UploadFile("http://image2you.ru/cabinet/upload/", uploadfile);
// "image_name=loolllo&Submit=Загрузить на сервер"
string url = "http://image2you.ru/cabinet/upload/";
string fileFormName = "uploadfile";
string contenttype = "image/pjpeg";
CookieContainer cookies;
if ((fileFormName == null) ||
(fileFormName.Length == 0))
{
fileFormName = "file";
}
if ((contenttype == null) ||
(contenttype.Length == 0))
{
contenttype = "application/octet-stream";
}
string postdata;
postdata = "?";
//if (querystring!=null)
//{
// foreach(string key in querystring.Keys)
// {
// postdata+= key +"=" + querystring.Get(key)+"&";
// }
//}
Uri uri = new Uri(url);
string boundary = "----------" + DateTime.Now.Ticks.ToString("x");
HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(uri);
webrequest.Referer = url;
//webrequest.KeepAlive = false;
//webrequest.Headers.Add(HttpRequestHeader.Te, "deflate, gzip, chunked, identity, trailers");
webrequest.Headers.Add(HttpRequestHeader.CacheControl, "no-cache");
webrequest.ServicePoint.Expect100Continue = true;
webrequest.Headers.Add(HttpRequestHeader.Cookie, sCookies);
webrequest.UserAgent = "Opera/9.80 (Windows NT 6.1; U; en) Presto/2.2.15 Version/10.01";
webrequest.Accept = "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1";
webrequest.Headers.Add("Accept-Language", "ru-RU,ru;q=0.9,en;q=0.8");
webrequest.Headers.Add("Accept-Encoding", "deflate, gzip, x-gzip, identity, *;q=0");
webrequest.Headers.Add("Accept-Charset", "iso-8859-1, utf-8, utf-16, *;q=0.1");
//webrequest.CookieContainer = cookies;
webrequest.ContentType = "multipart/form-data; boundary=" + boundary;
webrequest.Method = "POST";
StringBuilder sb = new StringBuilder();
//sb.Append("--");
sb.Append("--" + boundary);
sb.Append("\r\n");
sb.Append("Content-Disposition: form-data; name=\"image_name\"");
sb.Append("\r\n\r\n");
sb.Append("22");
sb.Append("\r\n");
sb.Append("--" + boundary);
sb.Append("\r\n");
sb.Append("Content-Disposition: form-data; name=\"image\"; filename=\"");
sb.Append(Path.GetFileName(uploadfile));
sb.Append("\"");
sb.Append("\r\n");
sb.Append("Content-Type: ");
sb.Append(contenttype);
sb.Append("\r\n");
sb.Append("\r\n");
string postHeader = sb.ToString();
byte[] postHeaderBytes = Encoding.GetEncoding(1251).GetBytes(postHeader);
StringBuilder sbb = new StringBuilder();
sbb.Append("\r\n" + "--" + boundary + "\r\n");
sbb.Append("Content-Disposition: form-data; name=\"Submit\"");
sbb.Append("\r\n\r\n");
sbb.Append("Загрузить на сервер");
sbb.Append("\r\n");
sbb.Append("--" + boundary + "--\r\n");
//sbb.Append("\r\n");
string postHeaderb = sbb.ToString();
byte[] boundaryBytes = Encoding.GetEncoding(1251).GetBytes(postHeaderb);
FileStream fileStream = new FileStream(uploadfile, FileMode.Open, FileAccess.Read);
long length = postHeaderBytes.Length + fileStream.Length + boundaryBytes.Length;
webrequest.ContentLength = length;
Stream requestStream = webrequest.GetRequestStream();
requestStream.Write(postHeaderBytes, 0, postHeaderBytes.Length);
byte[] buffer = new Byte[checked((uint)Math.Min(4096, (int)fileStream.Length))];
int bytesRead = 0;
while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
requestStream.Write(buffer, 0, bytesRead);
requestStream.Write(boundaryBytes, 0, boundaryBytes.Length);
WebResponse responce = webrequest.GetResponse();
Stream s = responce.GetResponseStream();
StreamReader sr = new StreamReader(s);
sr.ReadToEnd();