title: Run Go script from PHP
body: <p>I have a hosting with a PHP file which gets the request, take a string from it and have to give to Go (GoLang) script. How could I do it?</p>
  
  <p>package main
  My GO script:</p>
  
  <pre class="lang-go prettyprint-override"><code>package main
  
  import (
  "log"
  "fmt"
  "io/ioutil"
  "strings"
  ivona "github.com/jpadilla/ivona-go"
  )
  
  func main() {
      client := ivona.New("GDNAICTDMLSLU5426OAA", "2qUFTF8ZF9wqy7xoGBY+YXLEu+M2Qqalf/pSrd9m")
      text, err := ioutil.ReadFile("/Users/Igralino/Desktop/text.txt")
      if err != nil {
          log.Fatal(err)
      }
  
      arrayOfParagraphs := strings.Split(string(text), "\n\n")
      i := 0
      for _,paragraph := range arrayOfParagraphs {
          paragraph = strings.TrimSpace(paragraph)
          if (len(paragraph) &lt; 1) { // against empty lines
              continue
          }
          log.Printf("%v\n", paragraph)
          options := ivona.NewSpeechOptions(paragraph)
          options.Voice.Language = "ru-RU"
          options.Voice.Name = "Maxim"
          options.Voice.Gender = "Male"
          options.OutputFormat.Codec = "MP3"
          r, err := client.CreateSpeech(options)
          if err != nil {
              log.Fatal(err)
          }
  
          i++
          file := fmt.Sprintf("/Users/Igralino/Desktop/tts%04d.MP3", i) // files like 0001.ogg
          ioutil.WriteFile(file, r.Audio, 0644)
      }
  }
  </code></pre>