Clone of a website with php

Discussion in 'PHP' started by yourrapid, May 23, 2009.

  1. #1
    Hi,

    I saw a script before that make a clone of a website with .htaccess and 1 or 2 php files ...
    i know it was with curl or sth like this , in setting file u put the url of the site u want. for example en.wikipedia.org then in ur site , u will have all of wikipedia sites , without saving anything with ur link , like parking ur domain on there

    wikipedia.org/yourrapid ---> yourdomain.com/yourrapid exactly the same (also pictures were on the yourdomain.com ... i know they done it with .htaccess)

    i tried to code it , but i wasn't able to ...

    will you help me ?


    thanks
     
    yourrapid, May 23, 2009 IP
  2. WeedGrinch

    WeedGrinch Active Member

    Messages:
    1,236
    Likes Received:
    73
    Best Answers:
    0
    Trophy Points:
    90
    #2
    
    <?php
    
    
    
    $curl_handle=curl_init();
    curl_setopt($curl_handle,CURLOPT_URL,'http://alexa.com');
    curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
    curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
    $buffer = curl_exec($curl_handle);
    curl_close($curl_handle);
    
    if (empty($buffer))
    {
        print "Timed Out";
    }
    else
    {
        print $buffer;
    }
    
    ?>
    
    Code (markup):
    Works with some sites, hardly any major ones.. Doesn't pull stylesheets, but it's somewhere to start I guess.
     
    WeedGrinch, May 23, 2009 IP
  3. NatalicWolf

    NatalicWolf Peon

    Messages:
    262
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You are looking for a scraper...
     
    NatalicWolf, May 24, 2009 IP
  4. yourrapid

    yourrapid Peon

    Messages:
    243
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks , but in this curl example , we don't get the image urls , ... in our site place and as u said there is problem with style ... :(
    and , how to get urls of that website in our site , i mean replace the urls from alexa.org/siteowners to yourdomain.com/siteowners for example

    **** edit :

    i've find sth else works better , but the urls are still not replaced and are the main site urls..how to replace them with same name , i know we have to use .htaccess and mod rewrite :-s

    
    <?php
    
        function get_content($url)  
        {  
           $ch = curl_init();  
          
           curl_setopt ($ch, CURLOPT_URL, $url);  
           curl_setopt ($ch, CURLOPT_HEADER, 0);  
          
           ob_start();  
          
          curl_exec ($ch);  
          curl_close ($ch);  
          $string = ob_get_contents();  
        
          ob_end_clean();  
         
          return $string;      
       }  
         $content = get_content("http://www.forums.digitalpoint.com");  
    echo $content ;
    
    ?>
    
    Code (markup):
     
    yourrapid, May 24, 2009 IP
  5. yourrapid

    yourrapid Peon

    Messages:
    243
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I still haven't any way to replace the urls of the site i'll make clone with my urls...

    any one will help ? :-s
     
    yourrapid, May 25, 2009 IP