Currency exchange rate parser in PHP

<?php

//where will we parse the information from
$content = file_get_contents(‘https://cryptolot.ru/kurs-btc’);

// We determine the position of the line to which everything needs to be cut off
$pos = strpos($content, ‘<span id=”rate_usd”>’);

// Cut off everything that goes to the position we need
$content = substr($content, $pos);

// In exactly the same way we find the position of the final line
$pos = strpos($content, ‘</span>’);

// Cut off the required number of characters from zero
$content = substr($content, 0, $pos);

// if there is a text in the text that we don’t need, we cut it out
$content = str_replace(‘text to be cut’,”, $content);

// output the paired text.
echo $content;


?>
<?php
function parse($p1,$p2,$p3){
$num1 = strpos($p1,$p2);
if(!$num1) return 0 ;
$num2 = substr($p1,$num1);
return substr($num2,0,strpos($num2,$p3));
}
$link = file_get_contents(“https://www.banki.ru/products/currency/usd/”);
$start_teg = “<h1 class=’header-h0′ data-test=’header’>”; // Start of tags to parse from
$stop_teg = “</h1>”; //Parse tags before kudo
echo parse($link,$start_teg,$stop_teg);


?>

Check Also

CashWars roulette script

CashWars roulette script

CashWars roulette script Password is the word password ➜ [ᴠɪᴘ] ᴅᴏᴡɴʟᴏᴀᴅ ᴅᴏᴡɴʟᴏᴀᴅ ɪs ᴀᴠᴀɪʟᴀʙʟᴇ ꜰᴏʀ …

Leave a Reply

Your email address will not be published. Required fields are marked *