Library code snippets
Interacting with TinyPic from C#
Interacting with TinyPic from C#
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!\r\n" +
"HTML link: " + (string)wtags.InputValue + "\r\n" +
"[IMG] tag: " + (string)wimg.InputValue + "\r\n" +
"Image URL: " + (string)wurl.InputValue);
}
You can download a complete project illustrating its usage here, for more convenience.
Related articles
Related podcasts
-
Episode 8: Virtual Machines
This week, we discuss the use of virtual machines in software development. Topics: Industry trends VMware vs. Virtual PC (and other virtualization technologies) Should you develop in a VM? VM Tips and tricks Links: Jeff (codinghorror) Atwood's post on ...
Events coming up
-
Dec
9
Los Angeles Hadoop December Meetup
Santa Monica, United States
Information on this weeks presentation: About The Presenter: Brian is a long-time Java developer and enterprise architect (lots of ESB and service-oriented projects), with happenstantial real-world cloud experience in the past few years including: developing a custom, open-source storage cloud for the NIH; cloud-based image processing and computing research for Canon.
Thanks
!--removed tag-->fdbdbdbdbdbdb
This thread is for discussions of Interacting with TinyPic from C#.