PHP file_get_contents() 问题

标签 php

我尝试使用 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/

相关文章:

PHP Javascript?当用户关闭页面或浏览器时做一些事情

php - 如何设置应用程序,使其在内存中具有持久进程,并且无需重新初始化即可运行?

javascript - 仅在指定的圆圈/区域中显示谷歌地图标记

php - 使用 SSL 时 CodeIgniter 无法定位模型

php - 从多个表中检索内容..可以吗?

php - preg_match 显示包含一个字符串和另外两个字符串之一的行

PHP 字符串包含整数

php - 通知: Undefined index in php even i defined index correct

php - Amazon SNS 使用 PHP 推送主题

php - Codeigniter 表单验证多个回调