public function searchNew()
{
$sid = //account_sid;
$token = //auth_token;
$client = new Services_Twilio($sid, $token);
$country = $this->input->post('select_country');
$type = $this->input->post('type');
$params = array(
'Contains' => $this->input->post('contains'),
'SmsEnabled' => $this->input->post('SMS'),
'MmsEnabled' => $this->input->post('MMS'),
'VoiceEnabled' => $this->input->post('Voice'),
'ExcludeAllAddressRequired' => TRUE,
'ExcludeLocalAddressRequired' => TRUE,
'ExcludeForeignAddressRequired' => TRUE
);
$numbers = $client->account->available_phone_numbers->getList($country, $type, $params);
return $numbers;
}
查看
<form action="<?php echo base_url('tenant/phone_numer/searhNew');?>" method="post">
<input type="text" name="contains" class="form-control mbottom1" id="user_firstname" placeholder="Enter a description name for your number">
<select name="select_country" id="select_country" class="form-control">
<option disabled selected>Country</option>
<option value="US">USA (+1)</option>
</select>
<input id="checkcap1" type="checkbox" name="Voice" class="radio1" value="True"/>Voice
<input id="checkcap2" type="checkbox" name="SMS" class="radio1" value="True"/>SMS
<input id="checkcap3" type="checkbox" name="MMS" class="radio1" value="True"/>MMS
<input id="checktype1" type="radio" name="type" class="radio2" value="Local"/>Local
<input id="checktype2" type="radio" name="type" class="radio2" value="Mobile"/>Mobile
<input id="checktype3" type="radio" name="type" class="radio2" value="TollFree"/>Toll-Free
<input id="checktype3" type="radio" name="type" class="radio2" value="National"/>National
<button type="Submit">Test Submit</button>
</form>
我需要幫助,從我的視圖文件得到$country,$type,$params
。我已經做了一些測試,當我改變$country = $this->input->post('select_country');
到$country = "US"
和其他變量爲一個靜態值,代碼工作正常,但是當我改變它各自的輸入我收到錯誤消息是
請求資源 /2010-04-01/Accounts/acount_sid/AvailablePhoneNumbers//Tollfree.json 未發現
感謝您的幫助。
只有當你改變爲這個** $ country = $ this-> input-> post('select_country'); **從這個** $ country =「US」**時,你有這個問題** ? –
首先通過使用POST字段將其他參數變爲動態來確定它是否在特定的國家/地區發生。 –
也使用$ _POST確保您獲取所有值或不使用它們各自的鍵在您的php代碼..並確保沒有任何空間..修剪它,如果它存在。 –