Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $arr = Array();
- $arr2 = Array("Compra: ", "Venda: ");
- $url = "http://www4.bcb.gov.br/pec/taxas/batch/taxas.asp?id=txdolar";
- $expRegular = "/[0-9],[0-9]{4}|[0-9],[0-9]{3}/";
- $initCurl = curl_init($url);
- curl_setopt($initCurl, CURLOPT_HEADER, 0);
- curl_setopt($initCurl, CURLOPT_RETURNTRANSFER, 1);
- $resultado = curl_exec($initCurl);
- preg_match_all($expRegular, $resultado, $arr);
- for ($i = 0; $i < count($arr[0]); $i += 1) {
- echo "<b>" . $arr2[$i] . "</b>" . $arr[0][$i] . "<br />";
- }
- curl_close($initCurl);
- // curl http://www4.bcb.gov.br/pec/taxas/batch/taxas.asp?id=txdolar | grep -oie [0-9],[0-9][0-9][0-9][0-9]
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement