Smal help in php return statement

Discussion in 'PHP' started by g_bot, Oct 12, 2009.

  1. #1
    
    
    class ultimate{
        var $minlength;
        var $minoc;
    function getUrl($url)
    {
        return file_get_contents($url);    
    }
    
    //parse tags function (extracting title,description , keywords of the page)
    function _parseTags($page) {
        $page=strtolower($page);
        $title = $description = $keywords = '';
        if (preg_match('/<title>(.*)<\/title>/i',$page,$ar)) $title = $ar[1];
        if (preg_match('/<meta name="description" content="(.*)"/i',$page,$ar)) $description = $ar[1];
        if (preg_match('/<meta name="keywords" content="(.*)"/i',$page,$ar)) $keywords = $ar[1];
        $res = array(
             'title'=>$title,
             'description'=>$description,
             'keywords'=>$keywords,
             );
        return $res;
      } // _parseTags
    
    
    
    PHP:
    Can any one tell me how can u use content from database instead of using return file_get_contents($url); to parse content from the given url.

    I have the content stored in a variable $webpage but how can i replace it with file_get_contents($url);
     
    g_bot, Oct 12, 2009 IP
  2. g_bot

    g_bot Well-Known Member

    Messages:
    248
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    150
    #2
    Thank you guys i got it myself :)
     
    g_bot, Oct 12, 2009 IP