toplan / phpsms

:iphone::rocket:Probably the most intelligent, elegant sms send library in php
MIT License
642 stars 130 forks source link

阿里云短信发送错误 #126

Closed hzkoala closed 7 years ago

hzkoala commented 7 years ago
toplan commented 7 years ago

@hzkoala 你好,请看下如下方式能行不:

  1. 打开源码文件,并找到 https://github.com/toplan/phpsms/blob/master/src/phpsms/agents/Agent.php#L170

  2. 改成

    public function curlPost($url, array $params = [], array $opts = [])
    {
        $options = [
            CURLOPT_POST => true,
            CURLOPT_URL  => $url,
        ];
        foreach ($opts as $key => $value) {
            if ($key !== CURLOPT_POST && $key !== CURLOPT_URL) {
                $options[$key] = $value;
            }
        }
        if (!array_key_exists(CURLOPT_POSTFIELDS, $options)) {
            $options[CURLOPT_POSTFIELDS] = $this->params($params);
        }
    
        return self::curl($options);
    }
hzkoala commented 7 years ago

@toplan 试了, 没有变化 按客服的意思, 应该是接口和参数不匹配, 跟请求的方法没啥关系 有空你本地测试一下, 应该也发不出去才正常 aliyun的新版本刚上, 可能用的还不多, 反馈少

toplan commented 7 years ago

@hzkoala 我怀疑是时区导致的问题 把 https://github.com/toplan/phpsms/blob/master/src/phpsms/agents/AliyunAgent.php#L44 这里的date函数换成gmdate看看

hzkoala commented 7 years ago

"{"RequestId":"FF733085-B27A-494E-B151-C0AC008708D6","HostId":"sms.aliyuncs.com","Code":"Forbidden","Message":"User not authorized to operate on the specified resource."}"

hzkoala commented 7 years ago

我看下是不是参数配置有问题

toplan commented 7 years ago

我本地试了下,报的这个错误:"{"RequestId":"F74BA463-AA6A-497C-9335-9EFFFD2DEC9E","HostId":"sms.aliyuncs.com","Code":"InvalidDayuStatus.Malformed","Message":"The specified dayu status is wrongly formed."}"

hzkoala commented 7 years ago

@toplan 我们分头修复一下吧, 搞定了at一下 :D

darkal commented 7 years ago

@hzkoala @toplan 提交了修复阿里云短信的pr

toplan commented 7 years ago

已经发布 1.8.3