Jump to content

Help with Blocking url


dunnsearch

Recommended Posts

Ok here is is:

$torrenthost = $torrenthost[0]; // torrent host name

$torrenthostlink = $torrenthostlink[0]; // torrent download link

$torrentnameinhost = $torrentnameinhost[0]; // torrent name in host

$torrentupdateinhost = $torrentupdateinhost[0]; // torrent update time

$blockedsites = array("test.com", "www.anothertest.com", "www.example.com", "url.com", "www.phpfreaksexample.com");

if (in_array($torrenthost, $torrenthostlink, $blockedsites)) {} else {

 

How can i replace them with another url if theye should up on page

 

What to put in?

if (in_array($torrenthost, $torrenthostlink, $blockedsites)) {} else {

???

Just to block it from appearing. You see. I have created a meta search engine but it also picks up adverts from the search engines it searches. I need to remove these links from the files list. So just to block it from appearing on my site will do

If the page contents is inside a string what you could do is create an array with all of the bad urls that you do not want in your page, then do a loop through that array. In the loop see if the page contains the 'bad site' and replace it with whatever else you want:

 

<?php
$sPageContent = "blah blah blah, look at this website: http://badurl2.com!";
$aBadSites = array("http://badurl1.com", "http://badurl2.com", "http://badurl3.com", etc);

foreach($aBadSites as $sBadSite) {
$sPageContent = str_replace($sBadSite, "http://goodsite.com", $sPageContent);
}

print $sPageContent;
?>

 

The output would be this:

 

blah blah blah, look at this website: http://goodsite.com!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.