joeytrumann joeytrumann - 8 months ago 29
PHP Question

Extracting data from blockchain using PHP curl

I am trying to grab the total USD value of a bitcoin wallet from blockchain using cURL. Here is my code:

$content2 = file_get_contents("");

preg_match('#<span data-c="([0-9\.]*)">$ ([0-9\.]*)</span>#Uis', $content2, $USDmatch);

$usd = $USDmatch[0];

echo "Total USD Donated: $usd";

I can't seem to figure it out. Any thoughts? I got it working for Bitcoin but for some reason it won't work for USD.


You need to use backslash to escape the dollar sign.

preg_match('#<span data-c="([0-9\.]*)">\$ ([0-9\.]*)</span>#Uis', $content2, $USDmatch);