Results 1 to 5 of 5

Thread: get text from any location, no selectors

  1. #1
    Join Date
    May 2010
    Posts
    39
    Thanks
    10
    Thanked 2 Times in 2 Posts

    Default get text from any location, no selectors

    Hi All,

    need to fetch some text from html, and there's no selectos

    below example, text that needed to be fetched is in bold:

    Be sure to use a descriptive title for your question that summarizes it. If your post includes code, wrap it around using the [CODE] tag7 for44 multi-line code, and the [ICODE] tag for inline code that's part of a sentence.


    i'm new to in php, so if anyone decides to help, please do full script with end result output and comments are most welcome!

    thanks in advance!

    P.S. is it possible to grab few exact lines from external html without going end of file?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    First, if you want someone to do this for you ("full script with end result output and comments") that's a lot to ask for free-- post this in the paid work requests area if that's what you need.

    Second, you'll need to give us more information. I don't see any identifying pattern in what you posted, so I have no idea how you would find it. (Even just doing it yourself by hand-- after that, we can figure out how to code it.) If you have any code you're working on post that as well.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    May 2010
    Posts
    39
    Thanks
    10
    Thanked 2 Times in 2 Posts

    Default

    Quote Originally Posted by djr33 View Post
    First, if you want someone to do this for you ("full script with end result output and comments") that's a lot to ask for free-- post this in the paid work requests area if that's what you need.

    Second, you'll need to give us more information. I don't see any identifying pattern in what you posted, so I have no idea how you would find it. (Even just doing it yourself by hand-- after that, we can figure out how to code it.) If you have any code you're working on post that as well.
    Paid job could be, but that's just not that big of a script, really just a minute with advanced knowledge of functions and syntax. Because, actually there's a selector there and that'd be the "space", but then how to count words from first word in black, then "space", then another word and "space", until you reach specific number of words.


    As for P.S. question...

    For example:

    PHP Code:
    $text fopen("http://localhost/test.html""r");

    while (!
    feof($text)) {

    $output fgets($text);

    print 
    $output;

    }
    fclose($text); 
    in this case you get the whole document with tags, but is there a way to get just line 70 to 90 and that's it, without having loading the whole html page. I don't even know how to request a line using PHP

    found this little thing, but somehow it doesn't do

    PHP Code:
    $file 'sample.txt';
    $f fopen($filer);
    while ( 
    $line fgets($f1000) ) {
    print 
    $line;

    and this, doen't work either

    PHP Code:
    $file $_GET['name'];
    $f fopen($filer);
    while ( 
    $line fgets($f1000) ) {
    print 
    $line;


  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by NickNameDrive View Post
    Paid job could be, but that's just not that big of a script, really just a minute with advanced knowledge of functions and syntax.
    telling people that their work -however trivial you may think it is- is not worth paying for is a sure-fire way to get no one to help you.

    either be willing to put in some effort in figuring it out yourself, or hire someone - obviously, if it's a skill set you don't have, it's worth something.

    ----------

    Quote Originally Posted by NickNameDrive View Post
    is there a way to get just line 70 to 90 and that's it, without having loading the whole html page
    no. you can, however, ignore all the lines up to line 70, and all the lines after 90. is that what you want to do? will your target text always be lines 70-90? (from your example it would seem not.)

    there's not much that can be done without knowing how you expect to find the text you want (how to identify it).
    Last edited by traq; 10-22-2011 at 04:43 AM.

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    One of the hardest things to do in programming is to make computers handle language. Here, first we need to determine exactly what the pattern is. Then it can be programmed. But a computer can't do things that a human can easily-- a computer needs very specific patterns that are reliable, or at the very least you'll have some errors some of the time.

    A space character is something you can locate or use to split, but there are many of them and you will need to find a way to decide which one is correct.


    Regardless of how "difficult" it is, the way is works here is pretty simple: if you need some help with what you're doing, we can point you in the right direction (for example by suggesting an idea or looking for an error in your code), but to actually do a complete project, that's where it becomes a paid project. If it really is "easy" then it won't be an expensive project, but it would still be beyond what we normally offer here. (Sometimes particularly generous member may help, but it's certainly not guaranteed.)
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

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