Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php fopen中的URL错误2912($URL,“r”)_Php - Fatal编程技术网

Php fopen中的URL错误2912($URL,“r”)

Php fopen中的URL错误2912($URL,“r”),php,Php,当我通过PHP中的fopen($URL,“r”)请求URL时,我收到“error 2912” 例如: 它实际上在sms API上。我启动了一些变量来替换一些必填字段 $url = api.smartsmssolutions.com/smsapi.php?username=myusername&password=mypassword&sender=".$sender."&recipient=".$d3."&message=".$const_msg; 根据错误291

当我通过PHP中的
fopen($URL,“r”)
请求URL时,我收到“error 2912”

例如: 它实际上在sms API上。我启动了一些变量来替换一些必填字段

$url = api.smartsmssolutions.com/smsapi.php?username=myusername&password=mypassword&sender=".$sender."&recipient=".$d3."&message=".$const_msg;

根据错误2912,您的收件人为空。正确的格式如下所示

http://api.smartsmssolutions.com/smsapi.php?username=YourUsername&password=YourPassword&sender=SenderID&recipient=234809xxxxxxx,2348030000000&message=YourMessage
通过如下更改url进行检查

    $username = "YOUR_USERNAME";
    $password = "YOUR_PASSWORD";
    $sender   = "YOUR_ID";
    $d3       = "2348922223,2569878987";
    $const_msg = "YOUR_MESSAGE";
    $url = "http://api.smartsmssolutions.com/smsapi.php?username={$username}&password={$password}&sender={$sender}&recipient={$d3}&message={$const_msg}";

根据错误2912,您的收件人为空。正确的格式如下所示

http://api.smartsmssolutions.com/smsapi.php?username=YourUsername&password=YourPassword&sender=SenderID&recipient=234809xxxxxxx,2348030000000&message=YourMessage
通过如下更改url进行检查

    $username = "YOUR_USERNAME";
    $password = "YOUR_PASSWORD";
    $sender   = "YOUR_ID";
    $d3       = "2348922223,2569878987";
    $const_msg = "YOUR_MESSAGE";
    $url = "http://api.smartsmssolutions.com/smsapi.php?username={$username}&password={$password}&sender={$sender}&recipient={$d3}&message={$const_msg}";
请检查参数发送的正确值


请检查参数发送的正确值。

问题在于变量未正确启动。 我必须使用UrlEncode()将变量解析为fopen($url)

像这样

$urlt=“.UrlEncode($username)。“&password=“.UrlEncode($password)。”&sender=“。UrlEncode($sender) .“&收件人=234”。UrlEncode($d3)
.“,&message=”。UrlEncode($const_msg)

问题在于变量没有正确启动。 我必须使用UrlEncode()将变量解析为fopen($url)

像这样

$urlt=“.UrlEncode($username)。“&password=“.UrlEncode($password)。”&sender=“。UrlEncode($sender) .“&收件人=234”。UrlEncode($d3)
.“,&message=”。UrlEncode($const_msg)

pgp错误日志中是否有其他相关内容?pgp错误日志中是否有其他相关内容?请说明为什么URL中有大括号?我的意思是{…}我已经这样做了,但仍然会出现同样的错误。我的收件人不是空的,因为我必须在我的页面上回显才能看到它;出口这将转储易于诊断的url值。记得把$url变量放在后面。为什么url中有大括号?我的意思是{…}我已经这样做了,但仍然会出现同样的错误。我的收件人不是空的,因为我必须在我的页面上回显才能看到它;出口这将转储易于诊断的url值。记得把$url变量放在后面。