I'd like my program to have the ability to access an internet site that processes string input and returns some good info about this. I wish to input two sequences, publish them and browse the end result with the program. The web site may be the following:
Should you enter say 5031601 as Protein Title and DRNAYVWTLKGRTWKPTLVILRI as Sequence, you'll be rerouted towards the results site. This is actually the site I wish to have the ability to read with my program. I've investigated a great deal relating to this however i can't appear to obtain any helpful solution.
Can anybody please assist me?
I attempted to produce a web request using the following code (modified in the link):
WebRequest request = WebRequest.Create( "http://scansite.durch.edu/motifscan_seq") request.Method = "Publish" string postData = @"motif_option=all&protein_id=5031601&lifier sequence=DRNAYVWTLKGRTWKPTLVILRI&lifier stringency=High&submit=Submit Request" byte byteArray = Encoding.UTF8.GetBytes(postData) request.ContentType = "application/x-world wide web-form-urlencoded" request.ContentLength = byteArray.Length Stream dataStream = request.GetRequestStream() dataStream.Write(byteArray, , byteArray.Length) dataStream.Close() using (WebResponse response = request.GetResponse()) using (Stream resSteam = response.GetResponseStream()) using (StreamReader sr = new StreamReader(resSteam)) File.WriteAllText("SearchResults.html", sr.ReadToEnd()) System.Diagnostics.Process.Start("SearchResults.html")
After I open the SearchResults.html, it consists of the initial form site using the protein title joined. The succession has not been joined (it's a textarea, not really a textbox). Also it has not been posted. Can there be anything I am missing or doing wrong?
Resolved the problem by delivering the request towards the uri that's mentioned within the action attribute from the form tag (http://scansite.durch.edu/cgi-bin/motifscan_seq).
Your question's a little vague, but what it really seems like for you to do is screen scraping. What it really essentially means is you download the HTML from the page and parse it to seize the values you want.
The website under consideration requires a
Publish request towards the following URL:
Using the following parameters:
motif_option: all protein_id: 5031601 sequence: DRNAYVWTLKGRTWKPTLVILRI stringency: High submit: Submit Request
What you need to do is generate a
Publish request towards the URL and pass within the same key/value pairs, except together with your values rather. Here's some documentation regarding how to do this with C# (consider the example midway lower the page):
When you are getting the HTML back, you will have to parse it and discover the appropriate parts that you'll require. Regrettably, you will find no IDs or classes within the HTML and everything is made of tables, so this can be quite challenging. Here's another question that covers screen scraping in C#: