Doğru denediyine emin ol.
http://prntscr.com/jxcr2s
http://prntscr.com/jxcscz
Kodlar kullandım :
function siteConnect($site)
{
$ch = curl_init();
$hc = "YahooSeeker-Testing/v3.9 (compatible; Mozilla 4.0; MSIE 5.5; Yahoo! Search - Web Search)";
curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com');
curl_setopt($ch, CURLOPT_URL, $site);
curl_setopt($ch, CURLOPT_USERAGENT, $hc);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$site = curl_exec($ch);
curl_close($ch);
// Veriyi parçalama işlemi
preg_match_all('@(.*?)@si',$site,$veri_derece1);
$ltcfiyat = $veri_derece1[1][0];
return $ltcfiyat;
}
function harun($site1)
{
$ch1 = curl_init();
$hc1 = "YahooSeeker-Testing/v3.9 (compatible; Mozilla 4.0; MSIE 5.5; Yahoo! Search - Web Search)";
curl_setopt($ch1, CURLOPT_REFERER, 'http://www.google.com');
curl_setopt($ch1, CURLOPT_URL, $site1);
curl_setopt($ch1, CURLOPT_USERAGENT, $hc1);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
$site1 = curl_exec($ch1);
curl_close($ch1);
// Veriyi parçalama işlemi
preg_match_all('@(.*?)@si',$site1,$veri_derece2);
$btgfiyat = $veri_derece2[1][0];
return $btgfiyat;
}
$giris = siteConnect('https://tr.investing.com/crypto/litecoin/ltc-usd?cid=945630');
$uysal = harun('https://tr.investing.com/crypto/bitcoin-gold/btg-usd');
echo $giris." - ".$uysal;