View Full Version : importing text
05-26-2004, 10:31 PM
05-26-2004, 10:40 PM
05-26-2004, 10:41 PM
One way to do it could be like this: (2 files)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
var myMsg = "Hello World!";
So now you can update my_text.js daily, and just change the value of myMsg. If that's not adequate, let me know. But I think that's the easiest way I can think of...
Also, on the index.html page, the place the script tags with that src wherever you'd like on your page.
Hope that helps,
05-26-2004, 10:41 PM
I only need to read localy from the server onto my web page. What FAQ are you talking about?
05-26-2004, 10:51 PM
05-26-2004, 11:31 PM
05-26-2004, 11:43 PM
Care to elaborate on that a little more? Like who owns that information? Was it created by you and resides on your server, or by someone else somewhere else?
Is it just a sentence on some page, a paragraph, or the whole page? If it's your page on your server, and just a sentence or a paragraph, you can just put that sentence/paragraph in a separate file (like how we did in my first post) and then you can include it in the original file AND in your new file (so the data is in one place, but viewed in two).
If it's some data on some other page on a different server altogether, then it's a server-side language issue. I don't know much about ASP, but using PHP you can use cURL or Snoopy to grab the contents of a web page, and then regular expressions to grab the particular data from that page. This is a bit trickier, so hopefully it's your own page on your own server.
So let us know what you're looking to do exactly..
05-26-2004, 11:52 PM
The information is on another page, just text, but from what I can see, there pages are ASPX, which doesn't that mean they take it from a database?
05-26-2004, 11:55 PM
I don't know, but it doesn't necessarily mean it's from a database..
Regardless, if you do a view source, can you see the text that you want? If so, then you can use cURL or Snoopy (PHP) to grab that text. ASP probably has some method of doing this also, I'm just unaware of it.
If you can't see it in the view source, you might be out of luck.
05-26-2004, 11:58 PM
Ok, sounds easy enough, just one thing the text is constantly changing, every day, it's stock quotes on coffee for every day, how would I grab this? I already checked out the source, and from the looks of things it's just plain text, but I don't think they change a whole page everyday as well. Also where do I get some info on Snoopy or cURL?
05-27-2004, 12:23 AM
You should look at this page everyday, and save the source of each day and then analyze it and figure out how you know what the data is so you can create some regular expressions to capture your data.
But if it's just stock quotes, Yahoo provides a 'web service' so that you can grab quotes off their page. Here's a link to a tutorial on how to do it using PHP:
Hope that helps,
05-27-2004, 06:05 AM
Well this is great and it works fine, but my problem is I don't need to know what one sole company did, but I need to know how coffee is priced in general in the NY Stock Exchange?
05-27-2004, 06:20 AM
This is the site I'm try to grab from, I know it's grabbing from somewhere else because the images are in english:
05-27-2004, 06:34 AM
I dunno, it looks like it might be a bit tricky. You're gonna need some hacking skills!
Well you should probably start posting in the PHP forums and explain your problem again. They'll be able to help you better over there.
Here's a link that might be helpful in learning this stuff:
Sorry I can't be of more assistance.
PS. It couldn't hurt to ask the website where they're grabbing the information from, could it? Might save you some time maybe... or not ;)
05-27-2004, 05:22 PM
Well I thought of asking them last night and all it actually came to mind, I might try it out... :thumbsup: Thanks for all your help.