abstract common curl call into function
Merge pull request #48 from mlloreda/cleanup

abstract common curl call into function