[FONT="Comic Sans MS"]Suppose there is a address:-www.xyz.com i want to change this address to www.abcd.com in my php page forcly.How to i change ?Please help me?[/FONT]
Roshan,
You need to provide more information than that.
Do you wish to SPECIFICALLY change 'www.xyz.com' to 'www.abcd.com' ? Or do you wish to look for ALL addresses, or a list of addresses?
You should look into:
str_replace(), preg_replace(), and/or preg_match_all() (used for searching for stuff)
There are other methods but that should get you started.
Thanx for reply brother.
Visitor write a bad site address in my reply page.I want to block some address.If anybody write www.xyz.com then i want its change into www.abcd.com automatically in php page.
Anyone help me???Its not work??
$out=str_replace('www.xyz.com','www.abcd.com',$in);
thanx bro .What represent $in ?
ROSHAN;10948037 wrote:thanx bro .What represent $in ?
the string you wish to change.
Can u give me ur gtalk address.
See the page .not workinghttp://tinypic.com/r/iqggh3/5
in your case $in should be $_POST['message']
thanx.ur code is working .
see code <?php $f=$_POST['word'];
$out=str_replace('www.xyz.com','www.abcd.com',$f); echo "$out"; ?> but the another probem is how to i add 3-4 sites name at the place of xyz.com??
str_replace will accept an array for both find and replace
thanx bro.