Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Extract data from any website. (http://www.go4expert.com/forums/extract-data-website-t28419/)

Alex.Gabriel 20May2012 22:59

Extract data from any website.
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 Code:

    <head><title>Fetch info from any website.</title></head>
    <form action="gfe.php" method="post">
    <input type="text" name="searchinfo" value=""/>
    <input type="submit" value="Get info"/>
// 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;
    if (
$test == ""){
"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) {
'No results found.';
$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 a($code_first_part,'">','</a>');
    <a rel="nofollow" href="http://www.go4expert.com/showthread.php?t=<?php echo $id;?>"><?php echo $title?></a>

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 .

shabbir 20May2012 23:23

Re: Extract data from any website.
No I am perfectly fine with this as long as it does not query too many times.

Alex.Gabriel 20May2012 23:24

Re: Extract data from any website.
That's why i allowed only 1 response to be seen.

All times are GMT +5.5. The time now is 19:16.