Program to read some text on firefox

This is a discussion on Program to read some text on firefox within the C Programming forums, part of the General Programming Boards category; Hi! How can I make a program in C, that reads some text information that is being displayed in a ...

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    4

    Program to read some text on firefox

    Hi!
    How can I make a program in C, that reads some text information that is being displayed in a website?
    I found this link:
    Interprocess Communications (Windows)
    But I don't know how to start...
    Thanks!

  2. #2
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    Does it specifically need to be when it's displayed in a browser? Because it may be easier, not to mention MUCH more portable (across OSs and versions of your browser) if you were to use networking functions/libraries to download the web page and then parse it.

    There are some libraries that are available that can help to download/parse web pages. I believe that libcurl is one, so you may want to google that. I'm not sure if it does parsing but it should get you started.

    If you are dead-set on reading it out of your actual browser it will probably be much more difficult. I'd say it would rely on reading the memory of the other browser or somehow locating where the browser is storing files.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,848
    Well that would be the hard way of doing it!

    If you want to just read a site and grab the HTML, then a library is probably the simplest approach.
    cURL and libcurl
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Apr 2010
    Posts
    4
    Yeah, first i thought about saving the HTML and take the information that I need from there. But the project must specifically read the text displayed in the browser (which may change).
    Is there a way to make the c program to save the webpage from firefox periodically?
    Thanks

  5. #5
    Registered User
    Join Date
    Apr 2010
    Posts
    4
    Hi Salem!
    I'll study the libray you sugested.
    Thanks!

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,848
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Apr 2010
    Posts
    4
    No.
    For example:
    There is a home broker site with the prices of shares. I need to take the prices and do some math on them to make a decision, based on my model.

  8. #8
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    Hi Salem!
    I'll study the libray you sugested.
    Thanks!
    Ouch.

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,848
    Well if you don't want to actually get messy with fetching pages yourself, consider...

    Wget for Windows

    Just give it a URL, and a filename to save it in - job done

    Though TBH, I'd probably do this in Perl (or similar).
    Not only does it have libraries already for fetching pages with minimal effort, there are plenty of tools for extracting the data as well. The entire MO for Perl is easy text handling and processing
    String parsing and handling in C is exceedingly messy by comparison.

    Have you checked the firefox plug-ins page for similar kinds of tools?
    Even if there is nothing that does what you want, there may be something "close enough" that might be tempting as an alternative starting point.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting text into MDI program
    By Rutabega in forum Windows Programming
    Replies: 0
    Last Post: 12-23-2005, 11:25 AM
  2. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 03:17 PM
  3. Read a file into a loop program
    By TimeClock in forum C Programming
    Replies: 5
    Last Post: 07-17-2003, 07:29 PM
  4. Read variables and stuff from a text file
    By ChrisJ in forum C++ Programming
    Replies: 1
    Last Post: 06-26-2003, 12:06 PM
  5. reading text from a file into your program
    By deltabird in forum C++ Programming
    Replies: 1
    Last Post: 06-26-2003, 11:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21