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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.