$file = simplexml_load_file("http://www.cbr.ru/scripts/XML_daily.asp?date_req=" . date("d/m/Y"));
$values = [];
foreach ($file as $el) {
if ($el->CharCode == 'USD' || $el->CharCode == 'EUR') {
$values[$el->CharCode->__toString()] = $el->Value->__toString();
}
}
print_r($values);
<?php
Pjax::begin(['id'=>'pjax-container-form']);
$form = ActiveForm::begin(['id' => 'form-feedback',
'enableAjaxValidation' => true,
'action' => '/feedback/index',
'options' => ['data-pjax' => true]
]);?>
<?= $form->field($model, 'name')->textInput(['value' => !Yii::$app->user->isGuest ? Yii::$app->user->identity->username : '']) ?>
<?= $form->field($model, 'email')->textInput(['type' => 'email', 'value' => !Yii::$app->user->isGuest ? Yii::$app->user->identity->email : ''])?>
<?= $form->field($model, 'comments')->textarea(['rows' => 5]) ?>
<?= $form->field($model, 'id_obj')->textInput(['type' => 'hidden', 'value' => $id_obj])->label(false)?>
<?= $form->field($model, 'type')->textInput(['type' => 'hidden', 'value' => $type])->label(false)?>
<div class="form-group">
<?= Html::submitButton('<span>Отправить</span>', ['class' => 'btn btn-primary reg-btn', 'name' => 'signup-button']) ?>
</div>
<?php ActiveForm::end(); ?>
<?php Pjax::end(); ?>
<?Pjax::begin(['id'=>'pjax-container-comments']);?>
<?= ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => '_list',
'layout' => "{summary}\n{items}\n{pager}",
'summary' => '',
'itemOptions' => [
'tag' => 'div',
'class' => 'feedback',
],
]);
?>
<? Pjax::end();?>
<?php
$this->registerJs('
$("#pjax-container-form").on("pjax:end", function() {
var url = "' . Url::toRoute(['/feedback/index']) . '";
$.pjax({url: url, container: "#pjax-container-comments"});
})');
?>