The Image To Text API allows you to convert images containing text into machine-readable text. This documentation provides details on how to make requests to the API and the expected responses.
The base URL for making API requests is:
To access the Image To Text API, you need to include an API key in the request header.
Header:
Replace 'YOUR_API_KEY' with your actual API key obtained from the service provider.
This endpoint allows you to directly upload an image file for text extraction.
Send a POST request to the base URL with the following headers and form data:
This endpoint allows you to provide the URL of the image to be processed for text extraction.
Send a POST request to the base URL with the following headers and JSON body:
This endpoint allows you to provide the image data as a Base64-encoded string.
Send a POST request to the base URL with the following headers and JSON body:
Place YOUR_API_KEY with your original API Key
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://www.imagetotext.info/api/imageToText', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('base64' => 'base64 encoded string'), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer YOUR_API_KEY', ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
The API response will be in JSON format. The structure of the response depends on the success or failure of the request.