Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.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不工作_Php_Laravel - Fatal编程技术网

Php 拉维尔的fopen不工作

Php 拉维尔的fopen不工作,php,laravel,Php,Laravel,我正在尝试在laravel控制器中使用fopen打开url。我有以下代码: $sendlink = "http://login.bulksms.my/websmsapi/ISendSMS.aspx?username=username&password=password&message=testing&mobile=601212345678&sender=Demo&type=1"; $fp = fopen($sen

我正在尝试在laravel控制器中使用fopen打开url。我有以下代码:

            $sendlink = "http://login.bulksms.my/websmsapi/ISendSMS.aspx?username=username&password=password&message=testing&mobile=601212345678&sender=Demo&type=1"; 

        $fp = fopen($sendlink, 'r');
         $result = ''; 
            $result .= fgets($fp, 128);
            //update to send history
            $pieces = explode(":", $result);
            $eng_status = $pieces[0]; // piece1
            $eng_sms_id = $pieces[1]; // piece2

            //record msg
            $newGroup = new Message;

            $newGroup->company_id = $companyId;
            $newGroup->contact_id = $sendId;
            $newGroup->contact_number = $phone;
            $newGroup->msg = $eng_msg;
            $newGroup->code = $eng_sms_id;
            $newGroup->save();      

        // close the socket connection:
        //deduct credit
        if($eng_status == '1701') {
            //minus credit
            $balanceCredit = $balanceCredit - $engCredit;
            $group = Company::where('id', $companyId)->first();

            $group->sms_credit = $balanceCredit;
            $group->save();     

        }
        fclose($fp);
但有趣的是,它只是不起作用,它所给予的回报是

//www.w3.org/TR/html4/strict.dtd">
知道会出什么问题吗?我在一个非框架文件上使用了相同的php代码。所以这似乎不是服务器问题。希望能在这里得到一些帮助

谢谢你,我犯了个错误

在发送消息进行处理之前,需要执行urlencode


Tq

哪个变量包含此值?我在一个laravel项目中测试了fopen部件,效果很好。