Jump to content

[SOLVED] Replace text in text area with str_replace


ugly-wan

Recommended Posts

Hi as i said at some point last week when i asked for help i am new to php and don't understand it completely.

 

Well what i want to do is enter a bunch of urls in to a text area and replace parts of the urls with something else in to another text area similar to THIS

This code is what i have come up with but how would i get that in to the same layout as the link above using str_replace or is there a better way?

<?
if($_GET['url']){$url = $_GET['url'];
$name = $_GET['name'];}else{ die('you forgot something try again');}

//Vreel Link String
$rawstring = "$url";

//placeholders array
$placeholders = array('http://beta.vreel.net/watch_', '.html',);
//Vreel replace values array
$vreelvals = array('http://olliestvlinks.hozzamedia.com/vreel/?vc=', '&name=',);

//vreel string
$vreelstr = str_replace($placeholders, $vreelvals, $rawstring);

echo "URL: ". $vreelstr ;
echo "$name";
?>

I hope you understand what i am saying

Regards Ollie

 

P.S this is how it works so far

http://olliestvlinks.hozzamedia.com/test/replace.php?url=http://beta.vreel.net/watch_23626.html&name=How%20To

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.