need solution to pull url of keyword search from search engine in windows forms application using C#

103 Views Asked by At

I'm creating an windows forms application in C#. I want to put a feature where user can get a url from different search engines based on keywords they provide. I'm facing the problem of how to grab the url from a search engine. I have tried regular expression but didn't work. I even tried this code but its not working as its opening the website in the browser. the code is:

string a;
private void button1_Click(object sender, EventArgs e)
{
    a=textBox1.Text;
    System.Diagnostics.Process.Start("http://www."+a+".com"); 
}

please help me out as other than this i'm unable to complete my college project

1

There are 1 best solutions below

3
On

You need to make WebRequest, which will return html. Then you need to find those links in html
https://msdn.microsoft.com/pl-pl/library/system.net.webrequest%28v=vs.110%29.aspx

To make search in google just build url like this:
https://www.google.pl/#q=search+string

I really don't know search engines policity, but you need to read it first, becouse making somethink like this could be illigal

I found that google doesn't allow this so it will be illegal!