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 {

???

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.