Hi all
I' need to change link inside variable with another link
example
$some_text = 'some text some text some text some text <a href=\"http://www.someurl.com/somedirectory/so ... php\">some text</a> some text some text some text <a href=\"http://www.someotherurl.com/someotherdi ... php\">some text</a> some text';
for each links in $some_text should be replaced with "http://" . $_SERVER['HTTP_HOST'] . /stranice/preg_str.php
if somebody coul point me in right direction
regards
ddragas
[SOLVED] change url in variable
Moderator: General Moderators
[SOLVED] change url in variable
Last edited by ddragas on Fri Mar 23, 2007 6:41 am, edited 1 time in total.
I've used search, but with no success
whatI'm trying to accomplish is:
- separate link from other text inside variable and put it in new variable
- if in new variable is some text (if (stristr($MY_SELF, "/FCKeditor/File/")))
- take name of file from link (basename) (some html file)
- read content of that file (certain number) (file_get_contents)
- change link with new link (str_replace)
As you can see I'm missing only first part (separate link from other text inside variable)
how can I do it?
whatI'm trying to accomplish is:
- separate link from other text inside variable and put it in new variable
- if in new variable is some text (if (stristr($MY_SELF, "/FCKeditor/File/")))
- take name of file from link (basename) (some html file)
- read content of that file (certain number) (file_get_contents)
- change link with new link (str_replace)
As you can see I'm missing only first part (separate link from other text inside variable)
how can I do it?