Jump to content

Extracting an url out of a string


djneel

Recommended Posts


You need the explode() command.

array explode ( string delimiter, string string [, int limit] )

So,

[code]$title = "<h2><a href="index.html">The Index Page</a></h2>"; //This assignment statement wont work
$kapow=explode('href="',$title);
$secondBlast = explode('"',$kapow[1]);

$urlFromTitle=$secondBlast[0];
[/code]

The $title assignment line wont work, so I'm guessing you have that string assigned in some other way.

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.