Conditional Match to URL?

I am looking to target ads on Certain URLs, I think it should be very simple but I don’t know PHP :frowning:

Can someone please translate the below logic in PHP?


if (UrlBeing Visited 'contains' xyz)

than execute


do nothing

Something like this should do

if(strpos($url, "xyz") !== false)
	// Execute: myAdCode
	// Do nothing

Oh, and if you wish to get the page that has been requested (is being viewed)

$url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];

You will have to change that slightly if your using https, however i didn’t want to complicate the example

$url = "";

if( strpos( $url , "leaks")){

echo 'execute code here';