嗨,我想获得我正在调用的最终 URI;我想知道我正在调用哪个 URI,因为我正在动态创建 URI。这是我尝试过的代码,但失败了。我正在使用最新版本的 Guzzel
http://docs.guzzlephp.org/en/latest/index.html
public function index(Request $request)
{
$firstName = '{% First Name %}';
$lastName = '{% Last Name %}';
$emailID = '{% Email ID %}';
$mobileNumber = '{% Mobile Number %}';
$sms = urldecode($request->input('sms'));
foreach (json_decode(substr(urldecode($request->input('messages')), 0, -6)) as $user)
{
$smsText = $sms;
if(strpos($sms, $firstName) != false || strpos($sms, $lastName) != false || strpos($sms, $emailID) != false || strpos($sms, $mobileNumber) != false)
{
$smsText = str_replace($firstName, explode(" ",$user->field_full_name_value)[0], $smsText);
$smsText = str_replace($lastName, explode(" ",$user->field_full_name_value)[1], $smsText);
$smsText = str_replace($emailID, $user->mail, $smsText);
$smsText=str_replace($mobileNumber, $user->field_phone_no_value, $smsText);
}
$response = $this->client->request(null,'/api/sendmsg.php',
['query'=>[
['user' => 'ray'],
['pass' => 'as'],
['sender' => 'abc'],
['phone' => 7411220923], //$user->field_phone_no_value
['text' => 'Test Message'], //$smsText
['priority' => 'ndnd'],
['stype' => 'normal']
]]);
}
}