23.01.2015 Views

View as PDF - Yandex API

View as PDF - Yandex API

View as PDF - Yandex API

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Developer's guide<br />

23<br />

<br />

<br />

<br />

Robot request<br />

<br />

http://captcha.image.gif<br />

CAPTCHA ID number<br />

Status<br />

<br />

5. The user is returned a page containing a CAPTCHA.<br />

6. The user sends the CAPTCHA value to the partner.<br />

7. The partner sends the CAPTCHA value obtained from the user via a GET request in the following format:<br />

http://xmlsearch.yandex.ru/xcheckcaptchakey=&rep=<br />

8. The value received is checked by the <strong>Yandex</strong>.XML service. If the CAPTCHA value w<strong>as</strong> entered incorrectly,<br />

the process continues to step 4. In addition, the captcha-status parameter is p<strong>as</strong>sed with the value<br />

“failed”.<br />

9. If the CAPTCHA value w<strong>as</strong> entered correctly, <strong>Yandex</strong>.XML issues the user a "spravka" cookie and p<strong>as</strong>ses<br />

it to the partner in the header with the following format:<br />

HTTP/1.1 200 OK<br />

Set-Cookie: spravka=<br />

If the request p<strong>as</strong>sed to <strong>Yandex</strong>.XML in step 1 w<strong>as</strong> saved successfully, the process continues to step 12.<br />

10. The partner lets the user enter a query.<br />

11. The user sends a query to the <strong>Yandex</strong>.XML partner.<br />

12. The search query is sent to the <strong>Yandex</strong>.XML service. Along with the request, the user's IP address<br />

and "spravka" cookie are p<strong>as</strong>sed.<br />

13. <strong>Yandex</strong>.XML processes the search query and generates results.<br />

14. An XML file with search results is returned to the partner.<br />

15. The partner returns the processed response to the user. If in step 9 the <strong>Yandex</strong>.XML issued a "spravka"<br />

cookie, it is saved on the user's computer.<br />

Tip:<br />

To try out how this flow works, use this script.<br />

Verifying correct CAPTCHA display<br />

To get familiar with the response format returned by <strong>Yandex</strong>.XML when a CAPTCHA is displayed, send<br />

a request (the value of the query parameter of the search request) with the following string:<br />

“e48a2b93de1740f48f6de0d45dc4192a”.<br />

The following GET request can be used by the user “xml-search-user” for reviewing the response format returned when<br />

a CAPTCHA is displayed:<br />

wget -q --header="X-Real-Ip: 127.0.0.1" -SO- 'http://xmlsearch.yandex.ru/xmlsearch<br />

user=xml-searchuser&key=03.44583456:c876e1b098gh65khg834ggg1jk4ll9j8&query=e48a2b93de1740f48f6de0d45dc4<br />

192a&showmecaptcha=yes'<br />

<strong>Yandex</strong>.XML<br />

Developer's guide

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!