Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1004293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:06:43+00:00 2026-05-16T08:06:43+00:00

I am using a website to find a keyword position in google search …

  • 0

I am using a website to find a keyword position in google search … i have two text boxes(one textbox for getting URL and another textbox for getting Keyword) and
,one label(to display the position of the keyword in the URl) and one button in my page…
When i clicked that button it have to get the URL and Keyword and search the keyword in google
and give the position…. i got that URL and Keyword and it s searching in the google properly but i have not get that Position…

How shall i get that position? Anyone Tell me the solutionof this… My code is

 protected void btnSubmit_Click(object sender, EventArgs e)
 {
    string strUrl = txtUrl.Text;
    Uri newUri = new Uri("http://www.Yahoo.com");
    int I = GetPosition(newUri, txtKeyword.Text);
 }


public static int GetPosition(Uri url, string searchTerm)
{
    string raw = "http://www.google.com/search?num=39&q={0}&btnG=Search";
    string search = string.Format(raw, HttpUtility.UrlEncode(searchTerm));

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(search);
    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
    {
        using (StreamReader reader = new StreamReader(response.GetResponseStream(),    Encoding.ASCII))
        {
            string html = reader.ReadToEnd();
            return FindPosition(html, url);
        }
    }
}


private static int FindPosition(string html, Uri url)
{
    string lookup = "(<a class=l href=\")(\\w+[a-zA-Z0-9.-?=/]*)";
    MatchCollection matches = Regex.Matches(html, lookup);

    for (int i = 0; i < matches.Count; i++)
    {
        string match = matches[i].Groups[2].Value;
        if (match.Contains(url.Host))
            return i + 1;
    }

    return 0;
}

Here i get that matches.count always 0 so it always returns Zero… How can i get matches.count

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:06:44+00:00Added an answer on May 16, 2026 at 8:06 am

    In the HTML for a Google results list, the href attribute for each result link appears before the class attribute, not after it.

    Try this:

    string lookup = "(<a href=\")(\\w+[a-zA-Z0-9.-?=/]*)\" class=l";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a drupal website using taxonomy. Now google indexed the taxonomy paths like:
I'm working on an EPiServer website using a Lucene.net based search engine. I have
i want to get website name using asp.net i have one website that website
Is it possible to find the database technology using for a website. eg. www.example.com/
I am using 960.gs for designing website layouts. I could not able to find
I'm trying to find a way to integrate my website, coded using Symfony with
i am using a website application for registration, in that application i have inserted
I have a website using ASP with an MS Access DB back-end for storing
I am using the following website to find elevation: http://gisdata.usgs.gov/xmlwebservices2/elevation_service.asmx/getElevation?X_Value=-78.85834070853889&Y_Value=43.869369104504585&Elevation_Units=METERS&Source_Layer=-1&Elevation_Only=true This provides a results
I am trying to create a website using Symfony and PostgreSQL. I cant find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.