0

I'm new to all this, so please be gentle. I know basic php and have WAMP installed on my computer. All I need is a simple way to transcribe audio files. I have the google cloud shell sdk installed and used that to have composer install the required files (copied and pasted the command from google's tutorial), which it put in a vendor folder.

I then modified the php code google put on github which I'll paste below. When I try to run the php file, however, I get the following error message(s). What am I doing wrong? :(

enter image description here

<?php

# [START speech_quickstart]
# Includes the autoloader for libraries installed with composer
require __DIR__ . '/vendor/autoload.php';


# Imports the Google Cloud client library
use Google\Cloud\Speech\SpeechClient;


# Your Google Cloud Platform project ID
$projectId = 'xxxx';


# Instantiates a client
$speech = new SpeechClient([
    'projectId' => $projectId,
    'languageCode' => 'en-US',
]);


# The name of the audio file to transcribe
$fileName = __DIR__ . '/audio/transcribe.mp3';


# The audio file's encoding and sample rate
$options = [
    'encoding' => 'LINEAR16',
    'sampleRateHertz' => 16000,
    'languageCode' => 'en-US',
    'enableWordTimeOffsets' => false,
    'enableAutomaticPunctuation' => true,
    'model' => 'video',
];


# Detects speech in the audio file
$results = $speech->recognize(fopen($fileName, 'r'), $options);
foreach ($results as $result) {
    echo 'Transcription: ' . $result->alternatives()[0]['transcript'] . PHP_EOL;
}


# [END speech_quickstart]
return $results;
Maxim
  • 4,075
  • 1
  • 14
  • 23
Jonathan Grant
  • 143
  • 2
  • 15
  • Please include a [mcve] and error message in the text of your question. – miken32 Sep 26 '18 at 19:13
  • This is minimal as all of it is needed to get the error message. I don't know how you can replicate it, however, as I'm assuming the issue is in the setup. – Jonathan Grant Sep 26 '18 at 20:31

1 Answers1

0

The error message indicate cURL does not have the list of certificate authority's certificates available, so is unable to verify the integrity of the connection to Google. The steps in this answer should resolve the issue.

David
  • 9,288
  • 1
  • 20
  • 52