Results 1 to 3 of 3

Thread: [RESOLVED] Getting a sentence from a site?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    7

    Resolved [RESOLVED] Getting a sentence from a site?

    I want to know how would I get a number from a sentence using file_get_contents and split? This is the code I'm using...

    Code:
    <?php
    
    $rs = file_get_contents("http://www.runescape.com/title.ws");
    
    list($rs) = split('There are currently', $rs);
    echo "$rs";
    
    ?>
    The sentence on the website is:-

    There are currently random number people playing!

    When I run the code it shows me the site and stops where the sentence is and just shows the letters "There" whats wrong with the code?

  2. #2
    Addicted Member
    Join Date
    May 2006
    Location
    Ithaca, NY
    Posts
    145

    Re: Getting a sentence from a site?

    PHP Code:
    <?php

    $rs 
    file_get_contents("http://www.runescape.com/title.ws");

    $pos strpos($rs'There are currently');
    $number substr($rs$pos 2050);
    $pos strpos($number' people playing');
    $number substr_replace($number''$pos);

    echo 
    $number//$number is the number...

    ?>

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    7

    Re: Getting a sentence from a site?

    Thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width