-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindImage.cs
More file actions
27 lines (25 loc) · 879 Bytes
/
FindImage.cs
File metadata and controls
27 lines (25 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using RestSharp;
using System.Linq;
namespace PhotoFinder
{
class FindImage
{
//http://www.google.com/searchbyimage/upload
public static string GetUriImage(string Path)
{
RestClient restClient = new RestClient("http://www.google.com/");
RestRequest restRequest = new RestRequest("searchbyimage/upload")
{
Method = Method.POST
};
restClient.FollowRedirects = false;
restRequest.AddHeader("Content-Type", "multipart/form-data");
restRequest.AddFile("encoded_image", Path);
var response = restClient.Execute(restRequest);
var ToReturn = response.Headers.ToList()
.Find(x => x.Name == "Location")
.Value.ToString();
return ToReturn;
}
}
}