Class ImagesToText_SocketClient

Description

Images To Text socket API Client

Located in /imagestotext.php (line 540)

ImagesToText_Client
   |
   --ImagesToText_SocketClient
Class Constant Summary
 FIRST_PORT = 8123
 HOST = 'api.imagestotext.com'
 LAST_PORT = 8130
 TERMINATOR = "\r\n"
Variable Summary
mixed $_sock
Method Summary
ImagesToText_SocketClient __construct ( $username,  $password)
void close ()
void get_captcha ( $cid)
void get_user ()
void report ( $cid)
void upload ( $captcha)
array|null _call (string $cmd, [array $payload = null])
void _connect ()
string _sendrecv (string $buf)
Variables
mixed $_sock = null (line 549)
  • access: protected

Inherited Variables

Inherited from ImagesToText_Client

ImagesToText_Client::$is_verbose
ImagesToText_Client::$_userpwd
Methods
Constructor __construct (line 722)
ImagesToText_SocketClient __construct ( $username,  $password)
  • $username
  • $password

Redefinition of:
ImagesToText_Client::__construct()
close (line 750)
void close ()

Redefinition of:
ImagesToText_Client::close()
Closes opened connection (if any), as gracefully as possible
get_captcha (line 801)
void get_captcha ( $cid)
  • $cid

Redefinition of:
ImagesToText_Client::get_captcha()
Returns CAPTCHA details
get_user (line 767)
void get_user ()

Redefinition of:
ImagesToText_Client::get_user()
Returns user details
report (line 814)
void report ( $cid)
  • $cid

Redefinition of:
ImagesToText_Client::report()
Reports an incorrectly solved CAPTCHA
upload (line 780)
void upload ( $captcha)
  • $captcha

Redefinition of:
ImagesToText_Client::upload()
Uploads a CAPTCHA
_call (line 644)

Makes an API call

  • return: API response hash map on success
  • throws: ImagesToText_IOException On network errors
  • throws: ImagesToText_ServerException On API server errors
  • throws: ImagesToText_AccessDeniedException On failed login attempt
  • throws: ImagesToText_InvalidCaptchaException On invalid CAPTCHAs rejected by the service
  • access: protected
array|null _call (string $cmd, [array $payload = null])
  • string $cmd: API command to call
  • array $payload: API request payload
_connect (line 558)

Opens a socket connection to the API server

  • throws: ImagesToText_RuntimeException When socket operations fail
  • throws: ImagesToText_IOException When API connection fails
  • access: protected
void _connect ()
_sendrecv (line 594)

Socket send()/recv() wrapper

  • return: Raw API response on success
  • throws: ImagesToText_IOException On network failures
  • access: protected
string _sendrecv (string $buf)
  • string $buf: Raw API request to send

Inherited Methods

Inherited From ImagesToText_Client

ImagesToText_Client::__construct()
ImagesToText_Client::close()
ImagesToText_Client::decode()
ImagesToText_Client::get_balance()
ImagesToText_Client::get_captcha()
ImagesToText_Client::get_text()
ImagesToText_Client::get_user()
ImagesToText_Client::parse_json_response()
ImagesToText_Client::parse_plain_response()
ImagesToText_Client::report()
ImagesToText_Client::upload()
ImagesToText_Client::_is_valid_captcha()
ImagesToText_Client::_load_captcha()
Class Constants
FIRST_PORT = 8123 (line 543)
HOST = 'api.imagestotext.com' (line 542)
LAST_PORT = 8130 (line 544)
TERMINATOR = "\r\n" (line 546)

Inherited Constants

Inherited from ImagesToText_Client

ImagesToText_Client::API_VERSION
ImagesToText_Client::DEFAULT_TIMEOUT
ImagesToText_Client::POLLS_INTERVAL

Documentation generated on Fri, 11 Nov 2011 19:25:42 +0400 by phpDocumentor 1.4.3