473,699 Members | 2,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Do This Screen Scraping

I Have tried to fetch some XML data through screen scraping by the
following code:

System.Net.Serv icePointManager .CertificatePol icy = New
MyCertificatePo licy
dim path as String=""
Try
Dim req As HttpWebRequest = CType(WebReques t.Create(path),
HttpWebRequest)
Dim res As HttpWebResponse = CType(req.GetRe sponse, HttpWebResponse )
Dim strm As Stream = res.GetResponse Stream
dim ds as New DataSet
ds.ReadXml(strm )
Catch ex As Exception

End Try

An exception is occuring in ds.ReadXml(strm ) The Exception says Root
Element missing.
Exception::
System.Xml.XmlE xception: The root element is missing.
at System.Xml.XmlT extReader.Read( )
at System.Xml.XmlR eader.MoveToCon tent()
at System.Data.Dat aSet.ReadXml(Xm lReader reader, Boolean
denyResolving)
at System.Data.Dat aSet.ReadXml(St ream stream)
at Flower.Module1. readMyXml(Strin g path)

(Note:The above code is written in readMyXML function in Module1)

But it is not returning the required XML data. Though the same code is
fetching required XML from a Desktop Based application.

The path from which i am fetching XML is Under SSL that is my URL
starts with "https://".
I also have tried with the below code. Here the data to post is been
seperated from the URL.
But here nothing is returned but a timeout is occuring at most probably
in calling "reqStream.Writ e()" method.

System.Net.Serv icePointManager .CertificatePol icy = New
MyCertificatePo licy
Dim b() As Byte
Dim postData As String = path.Substring( path.IndexOf("? ") + 1)
path = path.Substring( 0, path.IndexOf("? "))
b = System.Text.Enc oding.ASCII.Get Bytes(postData)
Try
Dim req As HttpWebRequest = CType(WebReques t.Create(path),
HttpWebRequest)
req.Method = "POST"
req.ContentType = "applicatio n/x-www-form-urlencoded"
req.ContentLeng th = b.Length
Dim reqStream As Stream = req.GetRequestS tream
reqStream.Write (b, 0, b.Length)

Dim res As HttpWebResponse = CType(req.GetRe sponse,
HttpWebResponse )
Dim strm As Stream = res.GetResponse Stream
Dim ds as New DataSet
ds.ReadXml(strm )

Catch ex As Exception
End Try

May 30 '06 #1
0 1326

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4351
by: Jonathan Epstein | last post by:
I would like to perform a more classical type of "screen scraping" than what most people now associate with this term. I only want to find all the text on the current screen, and obtain associated screen coordinates. This probably must be done using OCR. This need only run on Windows. A fairly-pure Python solution would be ideal because most of the software which would use this functionality is also written in Python. The ideal...
4
5734
by: Roland Hall | last post by:
Am I correct in assuming screen scraping is just the response text sent to the browser? If so, would that mean that this could not be screen scraped? function moi() { var tag = '<a href='; var tagType1 = '"mail'+'to:', tagType2 = '">', tagType3 = '<\/a>'; var user1 = 'web', user2 = 'master', user3 = '@'; var dom1 = 'danger', dom2 = 'ous', dom3 = 'ly'; var tld = '.us';...
2
8293
by: Me | last post by:
I am dealing with a poorly written windows application that does not contain an API. I would like to use C# to run a predetermied set of steps in the application and scrape the resulting data from the screen and write it to a SQL database. That said, I have no idea how to go about doing so in C#. Any ideas, samples or links would be greatly appreciated. Thank you.
0
2156
by: Robert Martinez | last post by:
I've seen a lot about screen scraping with .NET, mostly in VB.net. I have been able to convert most of it over, but it is still just very basic stuff. Can someone help direct me toward some good info / samples on the following: I want to be able to do 3 things: 1) Set up a module in IBUYSPY Portal (like in the right or left pane) that simply just scrapes headlines from certain sites. 2) Allow users to set up scraping of certain sites...
3
1686
by: _eee_ | last post by:
Does anyone know of a simple code module that can do screen scraping, including simulating user-entered pushbuttons, etc. I can get the first screen on a website with HttpWebRequest, but I need to follow up to that by simulating user entries, then get subsequent response screens to that entered data. I figure someone has done this elegantly.
3
2356
by: Jim Giblin | last post by:
I need to scrape specific information from another website, specifically the prices of precious metals from several different vendors. While I will credit the vendors as the data source, I do not want to use the format of their pages, and want the inforamtion consolidated to a single page of my design. I did something like this for a client a couple of years ago in ASP, but it was complex, and I do not have access to the code. A...
1
1552
by: niv | last post by:
Hello, I would like to screen scrape certain parts of a webpage...how can I do this in asp.net For instance.... a stockticker thats embeded on a webpage.. I dont want the entire page.. I would like just the stock ticker...
4
3453
by: rachel | last post by:
Hello, I am currently contracted out by a real estate agent. He has a page that he has created himself that has a list of homes.. their images and data in html format. He wants me to take this page and reformat it so that it looks different. Do I use screen scraping to do this? Could someone please point me to a good screen scraping
4
3315
by: different.engine | last post by:
Folks: I am screen scraping a large volume of data from Yahoo Finance each evening, and parsing with Beautiful Soup. I was wondering if anyone could give me some pointers on how to make it less obvious to Yahoo that this is what I am doing, as I fear that they probably monitor for this type of activity, and will soon ban my IP.
3
5164
by: WFDGW2 | last post by:
I want to write or obtain C++ code that will scrape text from a dialog box within a poker client, and then record that text somewhere else. What do I do? Thanks.
0
8691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8620
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8920
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8887
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3060
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2351
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.