Changed to using sprintf, simplified extracting dc and shortened return
Reverted sprintf to str_replace after Drew pointed out that it's easier to copy endpoint from the docs if using str_replace (as they already use a placeholder in this format).
Merge pull request #1 from ejeliot/master

Shortened return