| The following snippet will demonstrate how to interact with http://tinypic.com,an image mirroring service,directly from a C# application,using the WebRobot component available from http://foxtrot-xray.com/web-robot/ void uploadTinyPic(string imagetags,string filename)
{
foxtrot.xray.WebRobot wrobot = new foxtrot.xray.WebRobot();
foxtrot.xray.Form wform;
foxtrot.xray.Input wtags;
foxtrot.xray.Input wimg;
foxtrot.xray.Input wurl;
wrobot.Base = "http://tinypic.com/";
wrobot.LoadPage("/");
wform = wrobot.Forms[0];
wtags = wform.GetFieldByName("the_tag");
wimg = wform.GetFieldByName("the_file");
wtags.InputValue = imagetags;
wimg.InputValue = filename;
wrobot.SubmitForm(wform);
wform = wrobot.Forms[0];
wtags = wform.GetFieldByName("mytag");
wimg = wform.GetFieldByName("myimg");
wurl = wform.GetFieldByName("myurl");
System.Windows.Forms.MessageBox.Show_
("Image uploaded successfully! "
"HTML link: "
(string)wtags.InputValue
" "
"[IMG] tag: "
(string)wimg.InputValue " "
"Image URL: " (string)wurl.InputValue);
}
|