Activity Stream
48,167 MEMBERS
61077 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 7 of 7
  1.     
    #1
    Member
    Website's:
    satiq.net

    Default Extract links

    Hi, I'm writing 1 script that take backup of my rapidshare links..

    But I have 1 problem: I can't extract from posts ID Links and Filename.

    I use that:

    Code: 
    <?php
    
    $url = file_get_contents("http://www.domain.com");
    $url = strip_tags( $url );
    $regex = '@^https?://(?:[\w\d]+\.)*rapidshare\.\w+/files/(\d+)/([^&?#/]+?)(?:$|[&?#/])@i';
    if(preg_match(
     $regex,$url, $matches)) {
     $file_url = $matches[0];
    $file_id = $matches[1];
    $file_name = $matches[2];
    }
    but I can only get entire link, like https://rapidshare.com/files/3220584445/test.zip

    Instead, if I write only the link like in this case:

    Code: 
    <?php
    
    $url = 'https://rapidshare.com/files/3220584445/test.zip';
    $regex = '@^https?://(?:[\w\d]+\.)*rapidshare\.\w+/files/(\d+)/([^&?#/]+?)(?:$|[&?#/])@i';
    if(preg_match(
     $regex,$url, $matches)) {
      
       $file_url = $matches[0];
    $file_id = $matches[1];
    $file_name = $matches[2];
    }
    ?>
    I get:

    Code: 
    Array
    (
        [0] => https://rapidshare.com/files/3220584445/test.zip
        [1] => 3220584445
        [2] => test.zip


    How can I extract only:
    3220584445
    test.zip
    from a html page?

    Thanks
    skinner Reviewed by skinner on . Extract links Hi, I'm writing 1 script that take backup of my rapidshare links.. But I have 1 problem: I can't extract from posts ID Links and Filename. I use that: <?php $url = file_get_contents("http://www.domain.com"); $url = strip_tags( $url ); Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Banned
    PHP Code: 
    <?php 
    $url 
    'https://rapidshare.com/files/322058444511/test.zip'
    $regex '@^https?://(?:[\w\d]+\.)*rapidshare\.\w+/files/(\d+)/([^&?#/]+?)(?:$|[&?#/])@i'
    preg_match($regex$url$matches);  
    /* Array (    
    [0] => https://rapidshare.com/files/322058444511/test.zip     
    [1] => 322058444511    
    [2] => test.zip ) 
    */  
    $file_url $matches[0]; $file_id $matches[1]; $file_name $matches[2]; echo  $file_url "\n" $file_id "\n" $file_name "\n";

  4.     
    #3
    Member
    Website's:
    sborg.us
    Explode?

    PHP Code: 
    <?php  

    print_r
    (explode('/','https://www.rapidshare.com/files/265645559/some.file.rar'));  

    ?>

    Result:
    Code: 
    Array (     
    [0] => https:     
    [1] =>      
    [2] => www.rapidshare.com     
    [3] => files     
    [4] => 265645559     
    [5] => some.file.rar
    )
    Save the index [4] value and you're done [trollface]

    V3g3ta | Halcyon | Abhi

  5.     
    #4
    Member
    Website's:
    wscripts.net damnlolscript.com lulzjet.com
    replace
    Code: 
    $regex = '#(http|https):\/\/rapidshare\.com\/([^\s]+)#is';
    with
    Code: 
    $regex = '#(http|https):\/\/rapidshare\.com\/files\/(\d+)\/([^\s]+)#is';

  6.     
    #5
    Member
    Website's:
    satiq.net
    Quote Originally Posted by Halcyon View Post
    Explode?

    PHP Code: 
    <?php  

    print_r
    (explode('/','https://www.rapidshare.com/files/265645559/some.file.rar'));  

    ?>

    Result:
    Code: 
    Array (     
    [0] => https:     
    [1] =>      
    [2] => www.rapidshare.com     
    [3] => files     
    [4] => 265645559     
    [5] => some.file.rar
    )
    Save the index [4] value and you're done [trollface]
    Thanks, it's what I need

  7.     
    #6
    Member
    Website's:
    epicimagehost.com
    Wouldn't go for the explode method..
    Stick with regex for such tasks.

    If you paste a NL link between the RS links, the script will still handle the NL link.
    But if you use the regex method, it'll simply ignore the NL link.

  8.     
    #7
    Member
    Website's:
    satiq.net
    So what code works? With that regex I can't find links..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. detect updates on a webpage and extract the file hoster links.
    By Mitt281 in forum Web Application/Script Support
    Replies: 0
    Last Post: 6th Nov 2012, 09:26 PM
  2. extract all links from a ftp page
    By Griz in forum Technical Help Desk Support
    Replies: 6
    Last Post: 25th Sep 2012, 04:21 PM
  3. how extract links of moevideo?
    By best87 in forum File Host Discussion
    Replies: 1
    Last Post: 8th May 2012, 06:21 AM
  4. extract multiple http links
    By KML in forum Webmaster Discussion
    Replies: 0
    Last Post: 27th Dec 2011, 01:33 AM
  5. tar.gz extract
    By praveer in forum Technical Help Desk Support
    Replies: 7
    Last Post: 30th Jul 2011, 05:11 PM

Tags for this Thread

BE SOCIAL