hi, i need a php script that would take all rapidshare links from this url(just an example): http://www.Haktec.com/3677-download-Meet-the-Browns-2008.html and save them into my mysql database. if someone knows how to do it please pm me. thank you, tastro
function getRapidshareLinks($url = '') { if(!$url) throw new Exception('No URL provided.'); preg_match_all('/rapidshare.com\/files\/[0-9]{1,9}\/[a-z0-9-_\.]+/i', $page = file_get_contents($url), $matches); return array_map(create_function('$url', 'return \'http://\' . $url;'), $matches[0]); } PHP: You can save it to an SQL yourself, easy enough - but I can understand how Regex can be confusing at first. Example: print_r(getRapidshareLinks('http://www.haktec.com/3677-download-Meet-the-Browns-2008.html')); PHP:
i done it myself before but the problem was to configure preg_match_all correct thank you very much dude
hi, but now when i try to insert it into mysql it does insert 'array' and not the links :S i did it like this: $test = getRapidshareLinks('http://www.haktec.com/3677-download-Meet-the-Browns-2008.html'); print $test; and inserted $test into mysql :S how to make this work ? :S thank you, tastro
ah... i think that i'm getting it i just have to include a loop actiob (FOR or WHILE) and then insert it like $test[$i] right ? $i is the loop, but anyways... an example would be nice thank you again :>
ok, now i have it like this: function getRapidshareLinks($url = '') { if(!$url) throw new Exception('No URL provided.'); preg_match_all('/rapidshare.com\/files\/[0-9]{1,9}\/[a-z0-9-_\.]+/i', $page = file_get_contents($url), $matches); return array_map(create_function('$url', 'return \'http://\' . $url;'), $matches[0]); } $test = getRapidshareLinks('http://www.haktec.com/3677-download-Meet-the-Browns-2008.html'); for ($i=0; $i<count($test); $i++) { $lol = "".$test[$i]."\n"; } but now it does add every rapidshare link to it's own field in mysql, and i want to add all the rapidshare links from one url to the same field. mysql_query("INSERT INTO rslinks (test) "."VALUES ('$lol')");
thank you very much to all that pmed me and or replayed here. no more help needed all is working fine