1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Extract data from any website.

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

  1. Alex.Gabriel

    Alex.Gabriel New Member

    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

    No I am perfectly fine with this as long as it does not query too many times.
     
  3. Alex.Gabriel

    Alex.Gabriel New Member

    That's why i allowed only 1 response to be seen.
     

Share This Page