Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Screen scraper again

Reply
Thread Tools

Screen scraper again

 
 
_eee_
Guest
Posts: n/a
 
      02-27-2004
I recently posted a query about screen scraping, but haven't turned up
any leads yet. Here's what I need to do:

The first screen is retrieved via HttpWebRequest/Response. Easy
enough, as no parameters are required. But then I need to fill in
some fields from that initial screen and POST it back to the website
(to get back info on a specific subject).

It seems easier to do a GET, but unfortunately I need to do this via
POST.

Surely this has been done a lot, right? Any clues on where to look?

Are there other newsgroups that would be more appropriate for this
question?

 
Reply With Quote
 
 
 
 
Eric Lawrence [MSFT]
Guest
Posts: n/a
 
      02-27-2004
Are you saying you're having a problem doing the POST? The following
function posts to a website and returns a response stream. The body of the
post is passed as a string (sPOST). If you need help figuring out what
should be in the post body, spend some time watching what IE passes up using
a tool like www.fiddlertool.com provides.

public static Stream DoHTTPPost(string sURL, string sLang, string sPOST)
{
HttpWebRequest oRequest = (HttpWebRequest)WebRequest.Create(sURL);
oRequest.UserAgent= "Picker/1.0";
oRequest.Headers.Add("Accept-Language", sLang);
oRequest.Method = "POST";
oRequest.ContentType="text/xml";
StreamWriter myWriter = null;
Stream strmPost = oRequest.GetRequestStream();
try
{
myWriter = new StreamWriter(strmPost, System.Text.Encoding.UTF;
myWriter.Write(sPOST);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
finally
{
myWriter.Close();
}

return oRequest.GetResponse().GetResponseStream();
}


--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.


"_eee_" <_> wrote in message
news:...
> I recently posted a query about screen scraping, but haven't turned up
> any leads yet. Here's what I need to do:
>
> The first screen is retrieved via HttpWebRequest/Response. Easy
> enough, as no parameters are required. But then I need to fill in
> some fields from that initial screen and POST it back to the website
> (to get back info on a specific subject).
>
> It seems easier to do a GET, but unfortunately I need to do this via
> POST.
>
> Surely this has been done a lot, right? Any clues on where to look?
>
> Are there other newsgroups that would be more appropriate for this
> question?
>



 
Reply With Quote
 
 
 
 
_eee_
Guest
Posts: n/a
 
      02-27-2004

On Thu, 26 Feb 2004 18:49:07 -0800, "Eric Lawrence [MSFT]"
<> wrote:

>Are you saying you're having a problem doing the POST? The following
>function posts to a website and returns a response stream.
>....


That was exactly what I was looking for, Eric!
Fiddlertool is also very useful.

Now, where did you find out how to do that?
Any books that cover it?


 
Reply With Quote
 
Eric Lawrence [MSFT]
Guest
Posts: n/a
 
      02-27-2004
I recommend O'Reilly's "HTTP: The Definitive Reference", which is the book I
used constantly when I was writing Fiddler in C#.

Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

"_eee_" <_> wrote in message
news:...
>
> On Thu, 26 Feb 2004 18:49:07 -0800, "Eric Lawrence [MSFT]"
> <> wrote:
>
> >Are you saying you're having a problem doing the POST? The following
> >function posts to a website and returns a response stream.
> >....

>
> That was exactly what I was looking for, Eric!
> Fiddlertool is also very useful.
>
> Now, where did you find out how to do that?
> Any books that cover it?
>
>



 
Reply With Quote
 
_eee_
Guest
Posts: n/a
 
      02-27-2004
On Fri, 27 Feb 2004 13:36:06 -0800, "Eric Lawrence [MSFT]"
<> wrote:

>I recommend O'Reilly's "HTTP: The Definitive Reference", which is the book I
>used constantly when I was writing Fiddler in C#.
>
>Thanks,
>
>Eric Lawrence
>Program Manager
>Assistance and Worldwide Services


You WROTE Fiddler? I should have put that together.
VERY nice program, Eric.

I'll look for the book.

 
Reply With Quote
 
Eric Lawrence [MSFT]
Guest
Posts: n/a
 
      02-28-2004
Thanks!

Please feel free to let me know (via the "Contact" link at fiddlertool.com)
if you have any suggestions for future Fiddler enhancements.

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

"_eee_" <_> wrote in message
news:...
> On Fri, 27 Feb 2004 13:36:06 -0800, "Eric Lawrence [MSFT]"
> <> wrote:
>
> >I recommend O'Reilly's "HTTP: The Definitive Reference", which is the

book I
> >used constantly when I was writing Fiddler in C#.
> >
> >Thanks,
> >
> >Eric Lawrence
> >Program Manager
> >Assistance and Worldwide Services

>
> You WROTE Fiddler? I should have put that together.
> VERY nice program, Eric.
>
> I'll look for the book.
>



 
Reply With Quote
 
_eee_
Guest
Posts: n/a
 
      02-28-2004
On Sat, 28 Feb 2004 00:02:26 -0800, "Eric Lawrence [MSFT]"
<> wrote:

>Thanks!
>
>Please feel free to let me know (via the "Contact" link at fiddlertool.com)
>if you have any suggestions for future Fiddler enhancements.
>
>Eric Lawrence
>Program Manager
>Assistance and Worldwide Services


I shall, Eric. It looks like the immediate problem is solved,
and Fiddler was very helpful for that. I'll probably be using it more
in future Asp.net projects. (Others on this group should take a look)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
my first screen scraper mensanator@aol.com Python 0 12-02-2007 04:25 AM
Python Screen Scraper James Stroud Python 7 04-25-2007 05:19 PM
Simple screen scraper using scrAPI doog Ruby 8 11-30-2006 08:27 PM
Screen Scraper _eee_ ASP .Net 3 02-25-2004 09:37 PM
Screen Scraper with Java API Dave Monroe Java 1 10-17-2003 01:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57