我尝试使用 API 和 PHP 中的 file_get_contents() 发送短信。
例如。
file_get_contents("http://testsmssite/SMS.php?username=xx&password=ccc&message=MESSAGE&numbers=1111111111&sender=11111");
在本地机器上它运行良好。
如果我将它放入服务器[SERVER A],它不起作用。如果我更改代码
IE。
file_get_contents("http://google.com");
它在服务器和本地都可以正常工作。
如果我把这个页面放在ie
file_get_contents("http://testsmssite/SMS.php?username=xx&password=ccc&message=MESSAGE&numbers=1111111111&sender=11111");
在另一台服务器[SERVER B]中它工作正常。
如果我的[SERVER A]有任何问题,那么它如何打开谷歌?
有人可以帮我解决这个问题吗?
最佳答案
不要使用file_get_contents
,而是尝试使用curl
。查看您收到的回复并检查 curl_error
。导致请求失败的可能原因有很多。
关于PHP file_get_contents() 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6839929/