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:
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:
I get:
How can I extract only:
3220584445
test.zip
from a html page?
Thanks
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
Last edited: