curl_setopt($ch, CURLOPT_POSTFIELDS, ['file' => new CURLFile($path)]);
public function uploadFile($url, $path)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
if (class_exists('\CURLFile')) {
curl_setopt($ch, CURLOPT_POSTFIELDS, ['file1' => new \CURLFile($path)]);
} else {
curl_setopt($ch, CURLOPT_POSTFIELDS, ['file1' => "@$path"]);
}
$data = curl_exec($ch);
curl_close($ch);
return json_decode($data, true);
}
public function getLive()
{
$games = Live::all();
$events = Events::all();
return view('live.index', compact('games', 'events'));
}
~^\+\d{7,15}$~
/^\+\d{7,15}$/
`^\+\d{7,15}$`
public function comments() {
return $this->hasMany('App\Comment')->selectRaw('id, name, SUBSTRING(comment, 30) as comment_limit')->orderBy('id', 'DESC');
}
<?php
$xml = <<<XML
<CurrencyRates Name="Daily Exchange Rates" Date="13.01.2016">
<Currency ISOCode="USD">
<Nominal>1</Nominal>
<Value>75,8985</Value>
</Currency>
<Currency ISOCode="EUR">
<Nominal>1</Nominal>
<Value>82,6117</Value>
</Currency>
</CurrencyRates>
XML;
$xml = simplexml_load_string($xml);
echo $xml['Date'];
foreach ($xml->Currency as $Currency) {
$number = $Currency->Value;
echo '<span class="cur-code">' . $Currency['ISOCode'] . '</span>';
echo '<span class="cur-val">' . sprintf('%.02f', str_replace(',', '.', $number)) . '</span>';
}