djtozz Posted September 29, 2009 Share Posted September 29, 2009 Hello, Following code is part of a link checker for files hosted on 4shared.com ( it simply checks out of a database with links if a file is still availible or not, if so... it should grab the "Filename" and "Filesize" and write that in a text file and mysql table. This code has worked before, but 4shared.com made some changes on their downloadpages. Sample url: http://www.4shared.com/file/102359073/b135d053/Plastik_Funk_-_Rise____Houseshaker_Mix_DRM__.html if($row[2]==5) // 4shared check { $row[1]="http://www.".$row[1]; $index=getpage($row[1]); preg_match("/Download ([^<]+)<\/div>/",$index,$match); if(strpos($index,"The file is shared for public access and download.")===false || !$match) { mysql_query("UPDATE `v2links` SET `checked`='-1',`lastcheck`=NOW() WHERE `id`=".$row[0]); print "bad link\n"; logstr("log-c.txt","bad link\n"); } else { $words=trim($match[1]); $words=preg_split("/[_\.\-\s]/",$words); $lastword=array_pop($words); $words=implode(" ",$words); $words=preg_replace("/\s{2,}/"," ",$words); $caption=mysql_real_escape_string($words); unset($words); unset($match); preg_match("/<td>Size\:<\/td><td>([^<]+)<\/td>/",$index,$match); $fsize=$match[1]; unset($match); print "$caption :: $fsize\n"; logstr("log-c.txt","$caption :: $fsize\n"); mysql_query("UPDATE `v2links` SET `checked`='1',`lastcheck`=NOW(),`fsize`='$fsize',`caption`='$caption' WHERE `id`=".$row[0]); if(mysql_errno()) print mysql_error()."\n"; } } I undertand that the script isn"t working anymore because following text isn't displayed anymore on their pages: "The file is shared for public access and download" So I tried to change that into "Kaspersky Anti-Virus" but NO lUCK Can anybody advice me how I could make this working again. Thanks, Quote Link to comment Share on other sites More sharing options...
djtozz Posted October 9, 2009 Author Share Posted October 9, 2009 "Kaspersky Anti-Virus" did the job, I guess I made another typo.. and I was able to catch file the file size thanks to an answer in another post. I used dom to do the job $dom = new DOMDocument; @$dom->loadHTML($index); $xpath = new DOMXPath($dom); $tdTag = $xpath->query('//td[@class="finforight"]/text()[contains(.,"KB")]'); // find text belonging to td node that contains the characters KB foreach($tdTag as $val){ } Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.