Wednesday, March 28, 2012

Web content access

Hello everyone,

It has been a while and I need some help. I need to access specific
information on a third party web site and return that specific information on
a web site I am working on. Is there a library or namespace I can use that
will provide support for such a feature or do I have to use client-side
scripting, namely the navigate function in javascript. Any help in this
matter will be much appreciated.

Thank you in advance,

Sam I am-My problem though, is how do I access the remote page? I thought of using
javascripts' Navigate or location Method or property but all that does is
redirect to the provided url. I need to grab the information on the remote
page, stuff it into a string and parse it while remaining at the local or
rather current page without being redirected. Do you know of a Library in
..NET or of the proper javascript method to use inorder to accomplish my
requirements?

"Milosz Skalecki [MCAD]" wrote:

Quote:

Originally Posted by

Hi Sam,
>
In this case i'd also recommend regular expressions.
>
Regards
--
Milosz
>
>
"I am Sam" wrote:
>

Quote:

Originally Posted by

I'll have to parse the HTML from the pages. Most likely though stuff the
encoded information into a StringBuilder or a string.

"Milosz Skalecki [MCAD]" wrote:

Quote:

Originally Posted by

Howdy,
>
Could you give us more details regarding the way data is exposed by this
third party website? do you have to parse HTML from the pages, or get XML
document?
--
Milosz
>
>
"I am Sam" wrote:
>
Hello everyone,

It has been a while and I need some help. I need to access specific
information on a third party web site and return that specific information on
a web site I am working on. Is there a library or namespace I can use that
will provide support for such a feature or do I have to use client-side
scripting, namely the navigate function in javascript. Any help in this
matter will be much appreciated.

Thank you in advance,

Sam I am-


I'll have to parse the HTML from the pages. Most likely though stuff the
encoded information into a StringBuilder or a string.

"Milosz Skalecki [MCAD]" wrote:

Quote:

Originally Posted by

Howdy,
>
Could you give us more details regarding the way data is exposed by this
third party website? do you have to parse HTML from the pages, or get XML
document?
--
Milosz
>
>
"I am Sam" wrote:
>

Quote:

Originally Posted by

Hello everyone,

It has been a while and I need some help. I need to access specific
information on a third party web site and return that specific information on
a web site I am working on. Is there a library or namespace I can use that
will provide support for such a feature or do I have to use client-side
scripting, namely the navigate function in javascript. Any help in this
matter will be much appreciated.

Thank you in advance,

Sam I am-


Howdy,

Could you give us more details regarding the way data is exposed by this
third party website? do you have to parse HTML from the pages, or get XML
document?
--
Milosz

"I am Sam" wrote:

Quote:

Originally Posted by

Hello everyone,
>
It has been a while and I need some help. I need to access specific
information on a third party web site and return that specific information on
a web site I am working on. Is there a library or namespace I can use that
will provide support for such a feature or do I have to use client-side
scripting, namely the navigate function in javascript. Any help in this
matter will be much appreciated.
>
Thank you in advance,
>
Sam I am-


Howdy,

Sorry for my late reply. It's quite simple:

System.Net.WebRequest request =
System.Net.WebRequest.Create("http://www.microsoft.com/en/us/default.aspx");

request.Method = "GET";
System.Net.WebResponse response = request.GetResponse();
System.IO.Stream stream = response.GetResponseStream();

System.IO.StreamReader reader =
new System.IO.StreamReader(stream);
System.Text.StringBuilder html =
new System.Text.StringBuilder(reader.ReadToEnd());

// do something with the html returned for the page
--
Milosz

"I am Sam" wrote:

Quote:

Originally Posted by

My problem though, is how do I access the remote page? I thought of using
javascripts' Navigate or location Method or property but all that does is
redirect to the provided url. I need to grab the information on the remote
page, stuff it into a string and parse it while remaining at the local or
rather current page without being redirected. Do you know of a Library in
.NET or of the proper javascript method to use inorder to accomplish my
requirements?
>
"Milosz Skalecki [MCAD]" wrote:
>

Quote:

Originally Posted by

Hi Sam,

In this case i'd also recommend regular expressions.

Regards
--
Milosz

"I am Sam" wrote:

Quote:

Originally Posted by

I'll have to parse the HTML from the pages. Most likely though stuff the
encoded information into a StringBuilder or a string.
>
"Milosz Skalecki [MCAD]" wrote:
>
Howdy,

Could you give us more details regarding the way data is exposed by this
third party website? do you have to parse HTML from the pages, or get XML
document?
--
Milosz


"I am Sam" wrote:

Hello everyone,
>
It has been a while and I need some help. I need to access specific
information on a third party web site and return that specific information on
a web site I am working on. Is there a library or namespace I can use that
will provide support for such a feature or do I have to use client-side
scripting, namely the navigate function in javascript. Any help in this
matter will be much appreciated.
>
Thank you in advance,
>
Sam I am-


Thank you for your reply nevertheless. I figured it out but I used
HttpWebRequest with streamreader and used the post method as opposed to the
get method.

Everything is working fine except now I am stuck with the monotonous task of
parsing the HTML to get the elements I need. It is specially difficult
because the elements I need do not have ID's so I have to use Regex and do
some pattern matching.
:-S boring stuff. I hate Regular Expressions.

I am Sam-

"Milosz Skalecki [MCAD]" wrote:

Quote:

Originally Posted by

Howdy,
>
Sorry for my late reply. It's quite simple:
>
System.Net.WebRequest request =
System.Net.WebRequest.Create("http://www.microsoft.com/en/us/default.aspx");
>
request.Method = "GET";
System.Net.WebResponse response = request.GetResponse();
System.IO.Stream stream = response.GetResponseStream();
>
System.IO.StreamReader reader =
new System.IO.StreamReader(stream);
System.Text.StringBuilder html =
new System.Text.StringBuilder(reader.ReadToEnd());
>
// do something with the html returned for the page
--
Milosz
>
>
"I am Sam" wrote:
>

Quote:

Originally Posted by

My problem though, is how do I access the remote page? I thought of using
javascripts' Navigate or location Method or property but all that does is
redirect to the provided url. I need to grab the information on the remote
page, stuff it into a string and parse it while remaining at the local or
rather current page without being redirected. Do you know of a Library in
.NET or of the proper javascript method to use inorder to accomplish my
requirements?

"Milosz Skalecki [MCAD]" wrote:

Quote:

Originally Posted by

Hi Sam,
>
In this case i'd also recommend regular expressions.
>
Regards
--
Milosz
>
>
"I am Sam" wrote:
>
I'll have to parse the HTML from the pages. Most likely though stuff the
encoded information into a StringBuilder or a string.

"Milosz Skalecki [MCAD]" wrote:

Howdy,
>
Could you give us more details regarding the way data is exposed by this
third party website? do you have to parse HTML from the pages, or get XML
document?
--
Milosz
>
>
"I am Sam" wrote:
>
Hello everyone,

It has been a while and I need some help. I need to access specific
information on a third party web site and return that specific information on
a web site I am working on. Is there a library or namespace I can use that
will provide support for such a feature or do I have to use client-side
scripting, namely the navigate function in javascript. Any help in this
matter will be much appreciated.

Thank you in advance,

Sam I am-

0 comments:

Post a Comment