david212 Posted October 7, 2009 Share Posted October 7, 2009 Hello! I need your help. Hello. I have web site on wordpress platform. I need some function for my posts. For example, if some publisher put download link with rapidshare, megaupload or filefactory, i'd like to detect rapidshare and megaupload links on the post and then do somethign like this if($url==megalink){ $mainurl="http://site.com/file.php?id=".megalink } could anyone help me please? Link to comment https://forums.phpfreaks.com/topic/176811-need-your-help/ Share on other sites More sharing options...
david212 Posted October 7, 2009 Author Share Posted October 7, 2009 i have this code but this is to detect images on post, is it possible to change this code and instead of image detect a href links? <?php $content = $post->post_content; $searchimages = '~<img [^>]* />~'; /*Run preg_match_all to grab all the images and save the results in $pics*/ preg_match_all( $searchimages, $content, $pics ); // Check to see if we have at least 1 image $iNumberOfPics = count($pics[0]); if ( $iNumberOfPics > 0 ) { // Your post have one or more images. } ?> Link to comment https://forums.phpfreaks.com/topic/176811-need-your-help/#findComment-932276 Share on other sites More sharing options...
Shocker88 Posted October 7, 2009 Share Posted October 7, 2009 Not quite sure what you mean here? So essentially it looks like you want to assign a specific URL if the URL that is posted by the user/author links to rapidshare and megaupload? If so you could use preg_match_all() as you have for the images, however I'd probably just use strpos() to check if the URL string inputted by the user includes megaupload or rapidshare.... If you need help with the code I can but just need clarification that is what you require? Link to comment https://forums.phpfreaks.com/topic/176811-need-your-help/#findComment-932288 Share on other sites More sharing options...
david212 Posted October 7, 2009 Author Share Posted October 7, 2009 thank you. All i want to do is find links in the post. for example this is the post: MindTerm is a secure shell client that implements the SSH1 and SSH2 protocols. It is written in Java and is available as a stand-alone application and as a library component that can be embedded in customer applications and in web pages where it can be downloaded as an applet. and we see 2 download links: Download: Rapidshare , MegaUpload and now having 2 download links of megaupload and rapidshare i need to detect their link with the function and once having this links do something like this if($url==megauploadlink){ $mainurl="http://site.com/file.php?id=".megauploadlink (http://www.megaupload.com/?d=RTOG5736) } or if($url==rapidsharelink){ $mainurl="http://site.com/file.php?id=".rapidshareink(http://rapidshare.com/files/28893343/myfiles.rar) } Link to comment https://forums.phpfreaks.com/topic/176811-need-your-help/#findComment-932299 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.