Jump to content

Regex Problem


FishBonez™

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/153813-regex-problem/
Share on other sites

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.