Results 1 to 7 of 7
-
8th Feb 2012, 05:51 PM #1OPMemberWebsite's:
satiq.netExtract 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]; }
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]; } ?>
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?
Thanksskinner 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
-
8th Feb 2012, 05:56 PM #2BannedPHP 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";
-
8th Feb 2012, 05:56 PM #3MemberWebsite's:
sborg.usExplode?
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 )
V3g3ta | Halcyon | Abhi
-
8th Feb 2012, 05:56 PM #4MemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comreplace
Code:$regex = '#(http|https):\/\/rapidshare\.com\/([^\s]+)#is';
Code:$regex = '#(http|https):\/\/rapidshare\.com\/files\/(\d+)\/([^\s]+)#is';
-
8th Feb 2012, 07:18 PM #5
-
9th Feb 2012, 10:15 AM #6MemberWebsite's:
epicimagehost.comWouldn'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.
-
9th Feb 2012, 11:08 AM #7OPMemberWebsite's:
satiq.netSo what code works? With that regex I can't find links..
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
detect updates on a webpage and extract the file hoster links.
By Mitt281 in forum Web Application/Script SupportReplies: 0Last Post: 6th Nov 2012, 09:26 PM -
extract all links from a ftp page
By Griz in forum Technical Help Desk SupportReplies: 6Last Post: 25th Sep 2012, 04:21 PM -
how extract links of moevideo?
By best87 in forum File Host DiscussionReplies: 1Last Post: 8th May 2012, 06:21 AM -
extract multiple http links
By KML in forum Webmaster DiscussionReplies: 0Last Post: 27th Dec 2011, 01:33 AM -
tar.gz extract
By praveer in forum Technical Help Desk SupportReplies: 7Last Post: 30th Jul 2011, 05:11 PM
themaCreator - create posts from...
Version 3.24 released. Open older version (or...