Results 1 to 8 of 8

Thread: Read html or php page

  1. #1
    Join Date
    Feb 2007
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Read html or php page

    is there a way for a scar to read html or php webpage data ?

    If yes then please give me some exemples and functions

  2. #2
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Code := GetPage('URLHere');


    Harry, he said for a scar.

  3. #3
    Join Date
    Feb 2007
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ohh yea , thats what I needed ; And thnx
    Now I only need to know the way how to work with that string ...

    Is there a way to delete for exemple those html tags from the string
    Is there a function to delete or find some strings in that variable ?

    Damn , I need to find some tuts for this :P
    Maybe the there are some good pascal tuts you can suggest ?

  4. #4
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    HTML := Between('<html>','</html>', HTML);
    WriteLn(HTML);

    Like that?


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  5. #5
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Like

    Code := GetPage(..);
    HTML := Between('<html>', '</html>', Code);

  6. #6
    Join Date
    Feb 2007
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yea , another function just what I needed :P

    Now I only need an exmplenation of function delete , guys ?

  7. #7
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Delete works best with Pos. Using the getting rid of html tags as an example,
    SCAR Code:
    function GetHTML(URLf: string): string;
    var
      i: integer;
    begin
      Result := GetPage(URLf);
      i := Pos('<html>', Result);
      Delete(Result,1,i+5);
      i := Pos('</html>', Result);
      Delete(Result, i, Length(Result)-i+1);
    end;
    It finds the first case of <html> in the page and removes everything until it (so from 1 to Position of the string) + 5 as Pos outputs the starting position (so the < in this case) and we add 5 to get it to take out all the tag. it then finds the closing tag, and deletes from the start of it (this time we don't add 1 as we want it to start from the <) and deletes all the chars from i to the length of the result, - i so that it goes to the end and then + 1 as it misses out the last char otherwise.

    Hope that helps to explain delete.
    Also, look up the PostHTTPPage bit in the scar manual if you want to be able to use Post or Get variables with the url (useful for when you want Scar to interact with a website).
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  8. #8
    Join Date
    Feb 2007
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Very good exmplenation , thnx

    One last thing ; So there is not a way to read php data with scar or pascal ?

    And what function should I use If I want to read the txt file the same way ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. HTML Basics?
    By Khazar in forum Web Development
    Replies: 15
    Last Post: 04-18-2011, 07:00 AM
  2. Need HTML Goodies please
    By P1nky in forum General
    Replies: 7
    Last Post: 07-26-2008, 10:39 PM
  3. html
    By hardman in forum Blogs and Writing
    Replies: 3
    Last Post: 09-22-2007, 12:59 AM
  4. HTML Scripting
    By Cheesehunk in forum General
    Replies: 3
    Last Post: 01-08-2007, 10:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •