1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Extract data from any website.

Discussion in 'PHP' started by Alex.Gabriel, May 20, 2012.

  1. Alex.Gabriel

    Alex.Gabriel New Member

    Joined:
    Oct 23, 2011
    Messages:
    86
    Likes Received:
    7
    Trophy Points:
    0
    Occupation:
    Linux system administrator
    Location:
    Italy
    Home Page:
    I have created this small code as an example for what this script can do. As everybody know vBulletin is a powerfull board cand can't be tricked easily.
    I have used G4F as example , i hope shabbir will not get angry :D
    PHP:
    <html>
        <head><title>Fetch info from any website.</title></head>
        <body>
        <center>
        <form action="gfe.php" method="post">
        <input type="text" name="searchinfo" value=""/>
        <input type="submit" value="Get info"/>
        </form>
        <?php
       
    // created by Alex Gabriel
      // http://ethicalforums.com
        
    function a($string$start$end){
        
    $string " ".$string;
        
    $ini strpos($string,$start);
        if (
    $ini == 0) return "";
        
    $ini += strlen($start);    
        
    $len strpos($string,$end,$ini) - $ini;
        return 
    substr($string,$ini,$len);
        }
        
    $test=$_POST['searchinfo'];
        if (
    $test == ""){
        echo 
    "Please insert any value";
        }
        else {
        
    $source file_get_contents ("http://www.go4expert.com/search.php?do=process&query=$test");
        if (
    stripos(strtolower($source), 'Sorry - no matches.') !== false) {
        echo 
    'No results found.';
        exit();
        }
        else 
        {
        
    $code_first_part a($source,'id="thread_title_','<span class="smallfont"');    
        
        
    //thread id
        
    $id=a($source,'<a rel="nofollow" href="showthread.php?t=','&amp;');
        
    //cleaning some stuff
        //title
        
    $title a($code_first_part,'">','</a>');
        
    ?>
        <a rel="nofollow" href="http://www.go4expert.com/showthread.php?t=<?php echo $id;?>"><?php echo $title?></a>
        <?php
        
    }
        }
        
    ?>
        </center>
        </body>
        </html> 
    This script will return the first result of any search peoples make on G4F on any website where this code is used. I have't made this script to show all the responses of a search query since i am not interested on this .
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    No I am perfectly fine with this as long as it does not query too many times.
     
  3. Alex.Gabriel

    Alex.Gabriel New Member

    Joined:
    Oct 23, 2011
    Messages:
    86
    Likes Received:
    7
    Trophy Points:
    0
    Occupation:
    Linux system administrator
    Location:
    Italy
    Home Page:
    That's why i allowed only 1 response to be seen.
     

Share This Page