Hello everyone,
I am trying to replace a string in some text. It is actually a url in the text. The url might look something like this:
www.itsportsnet.com/league.php?scriptName=Home&LeagueID=1
However, I need it to read:
www.itsportsnet.com/league.php?scriptName=Home&LeagueID=1&CampaignID=3
Basically I need to add '&CampaignID=3' to the end of the URL.
I tried doing this:
$theURL='www.itsportsnet.com/league.php?scriptName=Home&LeagueID=1';
$theNewURL='www.itsportsnet.com/league.php?scriptName=Home&LeagueID=1&CampaignID=3';
$theResult = ereg_replace ("$theURL", "$theNewURL", $theText);
When I print the result out though, the URL doesn't change! I am wonding if it is because there are numbers in the url link.
I read the following about ereg_replace:
<?php
/ This will not work as expected. /
$num = 4;
$string = "This string has four words.";
$string = ereg_replace('four', $num, $string);
echo $string; / Output: 'This string has words.' /
/ This will work. /
$num = '4';
$string = "This string has four words.";
$string = ereg_replace('four', $num, $string);
echo $string; / Output: 'This string has 4 words.' /
?>
Does anyone know if this is related? Can anyone tell me how to get around this.
Thanks for your time. Any help is greatly appreciated.
Sincerely,
Lena