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

FAKE CRYPTO EXCHANGE SCRIPT

FAKE CRYPTO EXCHANGE SCRIPT

Main Features: – Automatic address generation for each user – Automatic verification of deposits to …

Leave a Reply

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