Php 通过代理服务器从Javascript调用数据
我们有以下Javascript代码:Php 通过代理服务器从Javascript调用数据,php,javascript,api,post,google-chrome-extension,Php,Javascript,Api,Post,Google Chrome Extension,我们有以下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&am
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
/>ba simple proxy.php?url=http://example.com/&mode=native
//
//答复:
//
// > ...
//
//主题:注释
//
//*假设php.ini中的magic_quotes_gpc=Off
请参阅代理脚本的文档。您可以调用脚本并传递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
/>ba simple proxy.php?url=http://example.com/&mode=native
//
//答复:
//
// > ...
//
//主题:注释
//
//*假设php.ini中的magic_quotes_gpc=Off