php - fopen in laravel not working -
i've trying open url using fopen in laravel controller. have following code:
$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 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 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);
but funny thing not work , gives in return is
//www.w3.org/tr/html4/strict.dtd">
any idea go wrong? have same php code working on non framework file. doesn't seem server issue. hope can here.
thanks
a mistake on end.
it required urlencode before sending message processing.
tq
Comments
Post a Comment