Need code .. You will be rewarded for this

Discussion in 'Programming' started by sureshadams, Oct 14, 2008.

  1. #1
    Can anyone advice me on this please.

    We are starting a website. This will be for rating websites similar to www.xomreviews.com We need a code to automatically generate TItle, description and tags(keywords) of a site.

    When a website's URL is submitted in to our database, it should automatically display the title, description and tags(keywords of that site.) similar to www.xomreviews.com

    You will be rewarded for this.


    Thank you
     
    sureshadams, Oct 14, 2008 IP
  2. develop008

    develop008 Member

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #2
    I will help you to do this. Or should I do the code and send you through PM?
    :)
    Thanks
    Nissar
     
    develop008, Oct 15, 2008 IP
  3. robhustle

    robhustle Peon

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    why not post the code and share it with everyone?
     
    robhustle, Oct 16, 2008 IP
  4. robhustle

    robhustle Peon

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Okay, here is a quick function to get you started. To use it, copy the script below into your page. Then, just call the function like this:

    getURLMetaInfo('http://www.sitepoint.com/')

    It will return the information, if it found it. Otherwise, it might return some gibberish. You can clean it up to perform how you want.

    In addition to parsing the meta data, this script is also doing some useragent and referer spoofing here in case the pages are protected.

    Do I get a reward too?

    -------------------- SCRIPT BELOW ---------------------------


    <cfscript>
    function getTag(_string,_start,_end) {
    _startPos = findNocase(_start,_string) + len(_start);
    _endPos = findNoCase(_end,_string,_startPos) - _startPos;
    return mid(_string, _startPos, _endPos);
    }
    </cfscript>

    <cffunction name="getURLMetaInfo" access="public" returntype="struct">
    <cfargument name="src" required="true">

    <cfset var resultObj = structNew()>

    <!--- Retrieve the URL --->
    <cfhttp
    url="#arguments.src#"
    method="GET"
    useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2"
    result="objHttp">

    <!--- Spoof Referer just in case --->
    <cfhttpparam type="CGI" name="http_referer" value="#arguments.src#" encoded="false" />
    </cfhttp>

    <cfset _o = objHTTP.filecontent>

    <!--- Get the title --->
    <cfset resultObj.title = getTag(_o,"<title>","</title>")>
    <!--- Get the meta description --->
    <cfset resultObj.description = getTag(_o,'<meta name="keywords" content="','"')>
    <!--- Get the meta keywords --->
    <cfset resultObj.keywords = getTag(_o,'<meta name="description" content="','"')>

    <cfreturn resultObj>
    </cffunction>
     
    robhustle, Oct 16, 2008 IP