Jump to content

Archived

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

0p3n_p0rT

**SOLVED** Strings

Recommended Posts

Hey, I have something along the lines of this:
<?
$string = "

<html>
<title>sitename</title>
<FRAMESET ROWS="*,0" COLS="100%" border="0">
<FRAME SRC="do.php?d=XQE2VILT&l=en" noresize>
<FRAME SRC="s.php" noresize scrolling="no">
</FRAMESET>

</html>";
?>

And I want to extract just the "do.php?d=XQE2VILT&l=en" part. However, the querystring is random, and the length of this this may differ. I have tried various substr, strchr, etc. etc. and cannot extract that certain bit.

Can anybody help?

Thanks,
0p3n_p0rt.

Share this post


Link to post
Share on other sites
do you want all of do.php?d=XQE2VILT&l=en" or the "XQE2VILT" and "en" bits?

Share this post


Link to post
Share on other sites
Assuming you always have "do.php",

[code]$p1 = strpos($string,'do.php');
$p2 = strpos ($string, '"', $p1);

$result = substr ($string, $p1, $p2-$p1);

echo $result;[/code]

Share this post


Link to post
Share on other sites

×

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.