FishBonez™ Posted April 13, 2009 Share Posted April 13, 2009 Can someone help me to search this string which the data i fetched using cUrl. The string starts with https://seal.verisign.com and also contains the url of the remote site. For an example, i fetched the data from www.example.com . The desired string from the website: https://seal.verisign.com/getseal?host_name=www.example.com&size=L&use_flash=YES&use_transparent=YES&lang=en or https://seal.verisign.com/splash?form_file=fdf/splash.fdf&dn=www.example.com&lang=en Parts of my codes: <?php function getHost($url) { if(filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED) === FALSE) { return false; } $parts = parse_url($url); return $parts['host']; } $urlsecure = getHost($target_url); //curl process .. .. $text = curl_exec($ch); $regex = "/https:\/\/seal.verisign.com+(.)?+".$urlsecure."+(.)?/i"; // i'm having problem here // what is the correct regex to search the mentioned string? $verisign = preg_match($regex,$text,$matches_sec); if ($verisign) { echo "<br>Secure Link : <br>"; echo $matches_sec[0] . "<br />"; $checksecure = 1; } <? Any help would be greatly appreciated. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/153813-regex-problem/ Share on other sites More sharing options...
.josh Posted April 13, 2009 Share Posted April 13, 2009 if you're just looking for an exact match, strpos it. Quote Link to comment https://forums.phpfreaks.com/topic/153813-regex-problem/#findComment-808421 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.