473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to get the source code of another site on my form

I would like to be able to grab another sites source code and put it
into a field on my form so that I can then grab information from it.

The website is :
http://www.oddschecker.com/oddscheck...16x/sid/520998

(You may need to change the 559716 to a larger number if it doesn't
work)

Can anyone help ? I have tried a few things like view.source, iframes
but am either doing things wrong or they are being blocked.

Thanks
Paul

Jul 23 '05 #1
19 1980
"trower" <pa*********@mottmac.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I would like to be able to grab another sites source code and put it
into a field on my form so that I can then grab information from it.

The website is :
http://www.oddschecker.com/oddscheck...s/559716x/sid/
520998
(You may need to change the 559716 to a larger number if it doesn't
work)

Can anyone help ? I have tried a few things like view.source, iframes
but am either doing things wrong or they are being blocked.

Thanks
Paul


Will this help? Watch for word-wrap.

<html>
<head>
<title>oddschecker.htm</title>
<script type="text/javascript">
function Odds() {
var sURL =
"http://www.oddschecker.com/oddschecker/mode/o/card/m14099x/odds/559716x/sid
/520998";
document.getElementById("odds").innerHTML = sURL;
var oXML = new ActiveXObject("Microsoft.XMLHTTP");
oXML.Open("GET",sURL,false);
oXML.send();
try {
var sXML = oXML.ResponseText;
sXML = sXML.replace(/</g,"&lt;");
sXML = sXML.replace(/>/g,"&gt;");
document.getElementById("odds").innerHTML = sXML;
} catch(e) {
alert("Failed!");
}
}
</script>
</head>
<body>
<input type="button" value="Odds" onclick="Odds()">
<hr>
<span id="odds"></span>
<hr>
</form>
</body>
</html>
Jul 23 '05 #2
I tried clicking on the button and it just said "failed" !!
What should happen ? Does it work for you ?

Thanks
Paul

Jul 23 '05 #3
"trower" <pa*********@mottmac.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
I tried clicking on the button and it just said "failed" !!
What should happen ? Does it work for you ?

Thanks
Paul


It works for me.

Try it with a different URL to test it.
Jul 23 '05 #4
Ivo
"McKirahan" wrote
"trower" wrote
I tried clicking on the button and it just said "failed" !!
What should happen ? Does it work for you ?

Thanks
Paul


It works for me.

Try it with a different URL to test it.


It works fine when I run this script locally with any URL I give it. With in
a webpage it works only with URL's from the same domain. Other sites cannot
be loaded but result in a "Persmission denied" error. To make it work
cross-domain, you have to add the site that hosts the script to your
"Trusted Sites" list (via Tools -> Internet Options -> Security).

--
Ivo

Jul 23 '05 #5
"Ivo" <no@thank.you> wrote in message
news:41***********************@news.wanadoo.nl...
"McKirahan" wrote
"trower" wrote
I tried clicking on the button and it just said "failed" !!
What should happen ? Does it work for you ?

Thanks
Paul
It works for me.

Try it with a different URL to test it.


It works fine when I run this script locally with any URL I give it. With

in a webpage it works only with URL's from the same domain. Other sites cannot be loaded but result in a "Persmission denied" error. To make it work
cross-domain, you have to add the site that hosts the script to your
"Trusted Sites" list (via Tools -> Internet Options -> Security).

--
Ivo


I only ran it locally so I didn't have that issue.

Do you have to "put it into a field on my form so that I can then grab
information from it."? Have you considered using an HTA instead? HTAs are
basically Web pages that don't throw security warnings.
Jul 23 '05 #6
I don't know what an HTA is or how to set one up !!

I have tried the code again and it seems to be something to do with the
website I am trying to access.

The code works well with the first line but not the second one:

var sURL="http://www-10.lotus.com/ldd/46dom.nsf"
var sURL="http://www.oddschecker.com/oddschecker/mode/c/card/m14130x"

I have tried adding it to my trusted sites, is there anything else I
should do ? I am running IE 6.

Thanks
Paul

Jul 23 '05 #7
"trower" <pa*********@mottmac.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I don't know what an HTA is or how to set one up !!

I have tried the code again and it seems to be something to do with the
website I am trying to access.

The code works well with the first line but not the second one:

var sURL="http://www-10.lotus.com/ldd/46dom.nsf"
var sURL="http://www.oddschecker.com/oddschecker/mode/c/card/m14130x"

I have tried adding it to my trusted sites, is there anything else I
should do ? I am running IE 6.

Thanks
Paul


Instead of:
var oXML = new ActiveXObject("Microsoft.XMLHTTP");

Try:
var oXML = new ActiveXObject("Msxml2.XmlHttp");

I've seen this used in other places.

I'm not sure of the difference -- maybe someone will tell us...
Jul 23 '05 #8
Sorry No - it is still coming up with permission denied.

Thanks anyway though

Does anyone else out there know of anything.

Paul

Jul 23 '05 #9
"trower" <pa*********@mottmac.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
Sorry No - it is still coming up with permission denied.

Thanks anyway though

Does anyone else out there know of anything.

Paul


Try your page as an HTA (HTML Application).

Just rename the extension from ".htm" to ".hta".

What happens?
Jul 23 '05 #10
Don't think I can do that - I am writing using Lotus Notes !! I'll try
though.

Thanks
Paul

Jul 23 '05 #11
I feel stupid but I hadn't put the site correctly into the "trusted
sites" zone. Now when I click on the button it works fine. Sorry to
have messed you about.

Thanks
Paul

Jul 23 '05 #12


McKirahan wrote:
Instead of:
var oXML = new ActiveXObject("Microsoft.XMLHTTP");

Try:
var oXML = new ActiveXObject("Msxml2.XmlHttp");

I've seen this used in other places.

I'm not sure of the difference


There are different versions of the Microsoft XML software package
(sometimes called MSXML), IE 6 comes with MSXML 3 (!) where the HTTP
request object can be scripted as Msxml2.XMLHTTP. Older versions
installed with IE 5/5.5 can be scripted as Microsoft.XMLHTTP so if you
are scripting on the web where you don't know whether someone has IE 6
or IE 5 or IE 5.5 it is safer to use Microsoft.XMLHTTP.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #13
On Wed, 08 Dec 2004 12:31:52 GMT, McKirahan <Ne**@McKirahan.com> wrote:

[snip]
Try your page as an HTA (HTML Application).


[snip]

You're neglecting to remember that this is for a web site. Using an
IE-only HTA isn't very practical.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #14
one more thing - how can I get this to go information into another
field or how can I interrogate what is produced ?

what is the function on the line ?

<span id="odds"></span>

thanks
paul

Jul 23 '05 #15
"Michael Winter" <M.******@blueyonder.co.invalid> wrote in message
news:opsioxjpk4x13kvk@atlantis...
On Wed, 08 Dec 2004 12:31:52 GMT, McKirahan <Ne**@McKirahan.com> wrote:

[snip]
Try your page as an HTA (HTML Application).


[snip]

You're neglecting to remember that this is for a web site. Using an
IE-only HTA isn't very practical.

Mike


I don't know that it's for a Web site. I asked the following without a
response:

Do you have to "put it into a field on my form so that I can then grab
information from it."?

Perhaps "trower" just wants to get the page and parse it offline for some
purpose.

To focus my responses I'd like to find out what the application does and who
it's for.
Jul 23 '05 #16
"trower" <pa*********@mottmac.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
one more thing - how can I get this to go information into another
field or how can I interrogate what is produced ?

what is the function on the line ?

<span id="odds"></span>

thanks
paul


It's just a place to display the returned Web page's source code.

What do you want to do with the source?

You said something about putting it in a field but if you're talking about a
form field you'll probably have issues with the length (number of bytes) of
the source code.

What are you trying to do, for whom, and how will they access it?
Jul 23 '05 #17
it is now displaying the code on my page - how do i get it to go into a
field ?

i can make it alert but not get it into a field - any ideas ?

i have tried document.forms(0).field.value = sXML;
but it doesn't work

thanks
paul

Jul 23 '05 #18
On 8 Dec 2004 06:19:36 -0800, trower <pa*********@mottmac.com> wrote:

[snip]
i have tried document.forms(0).field.value = sXML;
but it doesn't work


At the very least, that should be

document.forms[0].field.value = sXML;

The forms property is a collection (think: limited array) so it must be
subscripted with square brackets, not parentheses. Whether that will solve
this particular issue depends on the HTML you are using.

As far as I can see, you *still* haven't stated who is going to be using
this. The XMLHTTP object doesn't work in all browsers so it has limited
application on the Web.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #19
"trower" <pa*********@mottmac.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
it is now displaying the code on my page - how do i get it to go into a
field ?

i can make it alert but not get it into a field - any ideas ?

i have tried document.forms(0).field.value = sXML;
but it doesn't work

thanks
paul


What are you going to do with over 60,000 bytes in a field?!
Jul 23 '05 #20

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

Similar topics

12
by: Mike B | last post by:
How do you make it source your source code is unreadable? I went to a website and tried to look at their source, and it came up blank. I then saved the file and got a message saying something...
17
by: /dev/null | last post by:
I have some php-based software that I'd like to make available to some businesses that run on my web server (apache on Linux). These businesses have full access to all their web files. I'd like...
2
by: yoelgold | last post by:
Hi I want to start writing a new site. It will include 3 forms that will collect information from the user. I know how to keep the info in sessions etc. my question is about the design of the...
18
by: John Dalberg | last post by:
Hello I have a login form on a page that should post the data to a non Windows server and upon successful authentication, the browser needs to show the secodn url. I did the form post, got...
8
by: sara | last post by:
I am learning Access and programming. I wanted to have the user select the departments for an ad from the list of all departments. Found code (that I could understand) on this site, and it works....
2
by: dgk | last post by:
I'm writing a very simple webpage, one label, one imagebutton, using Visual Studio 2003. I've changed the IP for security reasons as I'm not ready for visitors. The page is in grid mode and is the...
1
by: J.Marsch | last post by:
Hello all: I am trying to create a multi-project solution in VS 2005, and I'm having some problems with Source Control. I am running into 2 very vexing problems. Can anyone give me a pointer?...
24
by: Roman | last post by:
Hello to everybody, I have some question concerning blocking view source from main menu of IE or MF. I am able to block right click with <body oncontextmenu="return false"> but still missing from...
0
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.