Recent

Author Topic: easy way to pull some text off a webpage  (Read 1901 times)

nugax

  • Full Member
  • ***
  • Posts: 232
easy way to pull some text off a webpage
« on: February 19, 2018, 01:33:57 am »
Hi,

I am looking for a simple way to pull some text (not html just text) from a webpage.
Ive seen lots of synapse stuff googling, and thats a little much for what I want to do.

Does anyone know a simple way to request a webpage and read into a string the result of the page/request over simple http?
-Nugax

Thaddy

  • Hero Member
  • *****
  • Posts: 14359
  • Sensorship about opinions does not belong here.
Re: easy way to pull some text off a webpage
« Reply #1 on: February 19, 2018, 07:05:22 am »
This highly depends on the complexity of the web page. There are multiple examples on this forum.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

bytebites

  • Hero Member
  • *****
  • Posts: 639
Re: easy way to pull some text off a webpage
« Reply #2 on: February 19, 2018, 08:15:51 am »
Code: Pascal  [Select][+][-]
  1.  
  2. uses fphttpclient;
  3. ...
  4. var
  5.   s: String;
  6. begin
  7.   s := TFPCustomHTTPClient.SimpleGet('http://a_site/a_page');
  8. end;

Thaddy

  • Hero Member
  • *****
  • Posts: 14359
  • Sensorship about opinions does not belong here.
Re: easy way to pull some text off a webpage
« Reply #3 on: February 19, 2018, 08:19:35 am »
No, bytebites, that will fetch the complete html ...
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: easy way to pull some text off a webpage
« Reply #4 on: February 19, 2018, 10:01:32 am »
No, bytebites, that will fetch the complete html ...
I don't think you have any other choices, very seldom a web provides text/plain response along with text/html. What you can do is indeed grab the whole HTML and then strip the tags as needed.

 

TinyPortal © 2005-2018