我们在Javascript中有以下代码:
var speakMe = function (text) {
var key, lang, url, audio;
key = "key=1234567890";
lang = "sv_se";
url = "http://api.ttsengine.com/api/read?" + key + "&lang=en_us&voice=male1&speed=100&audioformat=ogg&oggbitrate=100&text=" + text;
audio = new Audio(url);
audio.play();
};
它的功能很好。不过,我想把钥匙戴上。为此,有人建议我使用PHP代理脚本。
我找到了这个代理,但我不知道如何实现它。我如何获得我通常获得的数据,但通过这个代理?
根据代理脚本的文档。您可以调用脚本并传递一个url
参数,然后它将返回内容。您还必须将mode=native
设置为另一个url参数。
// > ba-simple-proxy.php?url=http://example.com/&mode=native
//
// Response:
//
// > <html>...</html>
//
// Topic: Notes
//
// * Assumes magic_quotes_gpc = Off in php.ini