I am looking to target ads on Certain URLs, I think it should be very simple but I don’t know PHP
Can someone please translate the below logic in PHP?
i.e.
if (UrlBeing Visited 'contains' xyz)
than execute
{myAdCode}
else
do nothing
I am looking to target ads on Certain URLs, I think it should be very simple but I don’t know PHP
Can someone please translate the below logic in PHP?
i.e.
if (UrlBeing Visited 'contains' xyz)
than execute
{myAdCode}
else
do nothing
Something like this should do
if(strpos($url, "xyz") !== false)
{
// Execute: myAdCode
}
else
{
// 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 = "wikleaks.com";
if( strpos( $url , "leaks")){
echo 'execute code here';
}