$myCurl = curl_init();
curl_setopt_array($myCurl, array(
CURLOPT_URL => 'http://target.site.com/form.php',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query(array(/*здесь массив параметров запроса*/))
));
$response = curl_exec($myCurl);
curl_close($myCurl);
echo "Ответ на Ваш запрос: ".$response;
protected $hidden = [
'type_id',
'created_at',
'updated_at',
];
protected $hidden = [
'type_id',
'created_at',
'updated_at',
];
Category::with('posts.comments')->get();
public function getDateAttribute () {
return date('Y-M-D', $this->date);
}
public function getUrlAttribute () {
return url($this->slug);
}
protected $appends = [
'url',
'topic',
];
mix.styles([
'resources/assets/css/bootstrap.min.css',
// Другие стили
], 'public/css/styles.css');
mix.scripts([
'resources/assets/js/notification/SmartNotification.min.js',
// Другие js скрипты
], 'public/js/scripts.js');
<link rel="stylesheet" href="/css/styles.css">
<script type="text/javascript" src="/js/scripts.js"></script>
.pipe(autoprefixer({
overrideBrowserslist: ['last 2 versions'],
cascade: false
}))
class QiwiApi {
private $_phone;
private $_token;
private $_url;
function __construct($phone, $token) {
$this->_phone = $phone;
$this->_token = $token;
$this->_url = 'https://edge.qiwi.com/';
}
private function sendRequest($method, array $content = [], $post = false) {
$ch = curl_init();
if ($post) {
curl_setopt($ch, CURLOPT_URL, $this->_url . $method);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($content));
} else {
curl_setopt($ch, CURLOPT_URL, $this->_url . $method . '/?' . http_build_query($content));
}
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'Content-Type: application/json',
'Authorization: Bearer ' . $this->_token
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
return json_decode($result, 1);
}
public function getAccount(Array $params = []) {
return $this->sendRequest('person-profile/v1/profile/current', $params);
}
public function getPaymentsHistory(Array $params = []) {
return $this->sendRequest('payment-history/v1/persons/' . $this->_phone . '/payments', $params);
}
public function getPaymentsStats(Array $params = []) {
return $this->sendRequest('payment-history/v1/persons/' . $this->_phone . '/payments/total', $params);
}
public function getBalance() {
return $this->sendRequest('funding-sources/v1/accounts/current')['accounts'];
}
public function getTax($providerId) {
return $this->sendRequest('sinap/providers/'. $providerId .'/form');
}
public function sendMoneyToQiwi(Array $params = []) {
return $this->sendRequest('sinap/terms/99/payments', $params, 1);
}
public function sendMoneyToProvider($providerId, Array $params = []) {
return $this->sendRequest('sinap/terms/'. $providerId .'/payments', $params, 1);
}
}