Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.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 仅使用第一个单词发送消息_Php - Fatal编程技术网

Php 仅使用第一个单词发送消息

Php 仅使用第一个单词发送消息,php,Php,我试图发送短信使用PHP文件。URL中包含所有电子邮件属性。这里的问题是,只发送消息上的第一个单词 我不知道为什么 <?php $url = "http://sms-gates.com/smspro/sendsms.php?user=myuser&password=mypass&numbers=".$_GET['mobile']."&sender=JobSeeker&message=".$_GET['msg']."&lang=en"; $link

我试图发送短信使用PHP文件。URL中包含所有电子邮件属性。这里的问题是,只发送消息上的第一个单词

我不知道为什么

<?php
$url = "http://sms-gates.com/smspro/sendsms.php?user=myuser&password=mypass&numbers=".$_GET['mobile']."&sender=JobSeeker&message=".$_GET['msg']."&lang=en";

$link = fopen($url,"r");

while($res = fread($link,1024))
{

    echo $res;
}

fclose($link);
?>

您需要对参数进行URL编码,以将空格替换为%20,依此类推

$url = "http://sms-gates.com/smspro/sendsms.php?user=myuser&password=mypass&numbers=".urlencode($_GET['mobile'])."&sender=JobSeeker&message=".urlencode($_GET['msg'])."&lang=en";

您需要对参数进行URL编码,以将空格替换为%20,依此类推

$url = "http://sms-gates.com/smspro/sendsms.php?user=myuser&password=mypass&numbers=".urlencode($_GET['mobile'])."&sender=JobSeeker&message=".urlencode($_GET['msg'])."&lang=en";

不,他实际上需要阅读SMS网关API的手册,看看他需要做什么。不,他实际上需要阅读SMS网关API的手册,看看他需要做什么。使用
文件获取内容
而不是所有
$link
相关的东西。
msg
的价值是什么,您正在使用来测试?使用
文件获取内容
而不是所有
$link
相关内容。您正在使用
消息
的什么值来测试?