How to GET reCAPTCHA picture address? - c#

This is my idea:
I get this address from source, for example: http://api.recaptcha.net/challenge?k=6Lc_Wb0SAAAAAPpDWSnsxg7rFxSJT46Wmic3Ximb
Then I get "challenge" from this site, for example: challenge : '03AHJ_VuumDpsD-dz-rSeL_Vyd5fUqHMJLNtlpiyaEq0RzDhsaNTWTydaOcYk5cdRX55C6VyaojWJwCa6T6PF8LF4Io5NUC09Kj0HRNczh9tJXBsrx26BcfBtrwvPabvbR_SnJXdmc9YS2L76PqI9EdtfXPhhCV9V2jw'
Then I get address of picture, for example: http://www.google.com/recaptcha/api/image?c=03AHJ_VuumDpsD-dz-rSeL_Vyd5fUqHMJLNtlpiyaEq0RzDhsaNTWTydaOcYk5cdRX55C6VyaojWJwCa6T6PF8LF4Io5NUC09Kj0HRNczh9tJXBsrx26BcfBtrwvPabvbR_SnJXdmc9YS2L76PqI9EdtfXPhhCV9V2jw
But there is a problem - pic is other than I have to write. Can you tell me how I can get oryginal address?

If the image you get doesn't match up with the one that you have to type then I'm guessing you aren't passing the same challenge code to the verification method of the api as to the image part.
It would help if you could paste a bit of code.

If you look at the non-javascript API call output for how it actually gets fetched without all the javascript getting in the way, there wouldn't appear to be a reason your strategy would give the wrong image.
http://www.google.com/recaptcha/api/noscript?k=6Lc_Wb0SAAAAAPpDWSnsxg7rFxSJT46Wmic3Ximb

Mike got the point you need to pass recaptcha_challenge_field=03AHJ_VuumDpsD-dz-rSeL_Vyd5fUqHMJLNtlpiyaEq0RzDhsaNTWTydaOcYk5cdRX55C6VyaojWJwCa6T6PF8LF4Io5NUC09Kj0HRNczh9tJXBsrx26BcfBtrwvPabvbR_SnJXdmc9YS2L76PqI9EdtfXPhhCV9V2jw

Related

How to Open Default browser and target an element?

Hi all I have done some google work and not come up with a great deal apart from using the browser within a From which I dont want to do.
Has anybody some sample code or a good resource that is detailed enough to get me on my way plesae
So for example
Process.Start("https://www.google.com")
and target the search element with a string and click search.
Using the default browser
Please help me...
Doing something like this would work:
string mySearchQuery = "this is a search example";
Process.Start("https://www.google.com/search?q=" + Uri.EscapeDataString(mySearchQuery));
If I'm understanding you correctly, this would use the default browser set in windows, then the query is just passed in as a GET request (that's the ?q variable).

The type string is expected but a type integer was received with value 0

I am working on Marketing APIs. I want to hit this Api to get Estimate of Target Audiences, basically how much users will be able to see my ad.
"https://graph.facebook.com/v2.2/{adaccountid}/reachestimate"
I am getting the response until I pass this parameter "flexible_spec". Whenever I pass this parameter I get this response "The type string is expected but a type integer was received with value 0". I searched for it but no solution was there.
I will show you what I tried until now:
1)"https://graph.facebook.com/v2.2//{adaccountid}/reachestimate? targeting_spec={"geo_locations":{"countries": ["IN"]},"flexible_spec":{"interests":["6006289279425"]}}
2) "https://graph.facebook.com/v2.2//{adaccountid}/reachestimate? targeting_spec={"geo_locations":{"countries": ["IN"]},"flexible_spec":{"interests":["Movies"]}}
3)"https://graph.facebook.com/v2.2//{adaccountid}/reachestimate? targeting_spec={"geo_locations":{"countries": ["IN"]},"flexible_spec":{"interests":["id":"6006289279425","name":"Movies"]}}
I have tried sending an array of ids in flexible spec interests , array of name's in flexible_spec interests and I have also tried sending list<interests> in it. But no luck.
I searched alot about this error. Then i came to know about my mistake i am doing in this API. We can specify interests fields in two types:
1) targeting_spec={"geo_locations":{"countries":"IN"]},"flexible_spec":[{"interests":["6006289279425"]}]}
2) targeting_spec={"geo_locations":{"countries": ["IN"]},"interests":["6006289279425","46345343534"]}
first one passing interests array in flexible_spec array.
second one passing interests as an array object but not in flexible_spec.
This helped me . I am posting this answer because it might help you too in the same situation.
Thanks.

ABBYY OCR - How to use multiple region parameters in the Uri?

I'm working with ABBYY cloud OCR, when my popruse is to scan 3 specific places in each document that I'm scanning. These 3 places will always be the same so I want to use the ProcessFields function do it and having some problems with it.
When I want to scan only one specific place I used this :
string url1 = String.Format("http://cloud.ocrsdk.com/processFields?region=0,0,200,200&language=english");
When trying to scan 2 places I've tried this :
string url1 = String.Format("http://cloud.ocrsdk.com/processFields?region=0,0,200,200 region 100,100,100,100&language=english");
it gave me an error.
Anyone has any advise how to do it?
I also tried defieng 3 Uri's but as the upload is done only once - how can I reach the 2 other Uri's without scanning it again?
thanks a lot!
According to documentation of processField method, you can't pass field parameters in URI, you should form an XML and submit it using POST method instead of GET. There is also a sample XML file on that page.
Simple method with URI works only for one field and processTextField method.

Find the referring URL and parse it

Okay my problem is there are two websites with two different servers. What I'm trying to do is write some of the buttons for website 1, but on a page on my server (website 2).
So to do this the approach is
User clicks on button from website 1.
User is redirected to website 2.
I need to know what page they came from so I know what product they are looking at. Which will be done by getting the referrer URL.
I then need to parse the URL's productID's number.
example URL: website1.com/ProductDetails/?referrerPage=1&productID=#######&tab=Tile
I know that I need to use this piece of code to store the referrer URL in a string:
myReferrer = Request.UrlReferrer.ToString();
I don't really know where to place it tho. I'm guessing in my .cs file where my button is?
protected void btnEstimate_Click(object sender, EventArgs e)
{
connection strings
{
does stuff
{
does stuff
}
So my question is how do I get the referring URL, and then parse out the item ID?
Thanks for the help in advance. If anything is unclear please ask... this is my first time asking a question so I may be unclear. Thanks!
This should give you what you want:
Making Sense of ASP.NET Paths
Note that a fully qualified URL including querystring and extra path is a Uri instance rather than string. You can use the UriBuilder.Query Property to extract the query string parameter(s):
You need to parse the URI in the Page_Load method of the receiving site's page.
UriBuilder.Query Property
There's a server variable called HTTP_REFERER. You can access it with Request.ServerVariables("HTTP_REFERER")
It's misspelled, I know, but that's how you really need to call the server variable.
Your referrer server variable is only going to be populated if the user clicks on a link. AFAIK if you redirect, that variable is going to be empty.
Wikipedia Referer Article

Advice needed: Geolocation for c# web app - need country location to set what user can see or not

My scenario is I want to trap the user's country when they access the web page. Based on the user's country i want to set a cookie that will allow me to do a simple "if" statement in the code behind that would let them to see certain information on web pages.
I started doing some research and i can use the Google Geocode V3 and get the country from code behind c#. But to get the Google Geocode to work i need to pass in the longitude and latitude.
And the only way i've seen this is from Javascript call like:
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
});
}
So i'm hoping for some advice if I'm doing this right.
On the loaded method in my c# code I think I can get the javascript to run by ScriptManager.RegisterStartUpScript method. So my challenge now is getting the latitude and longitude values. Since i'm not going a button event or something, i need to get those values out and then pass them into my c# method that would get the country code using the Google Geocode.
Does that sound right? If this is the right path, can someone suggest how i could get those values from the javascript?
thanks.
You could make an Ajax call to your server which contains the client's geolocation.
What about using RegionInfo.CurrentRegion instead? That will give you the country according to the browser headers assuming you have globalization culture turned to auto. This is simpler, but will also not be 100% correct all the time since the user can change their culture settings.
You may also want to look into using IP address based geolocation which might be a little more accurate.
It would help to know why you're trying to do this.
Most sites that really need to make sure that content stays within national boundaries work with content that is chargeable - for instance, most music sites, Amazon, and so on.
Their simple, yet effective, technique is to use the country on the user's billing address on their credit card.

Categories

Resources