Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: ncsupanda on July 17, 2014, 01:44:45 AM



Title: Using curl in the Bitcoin Source
Post by: ncsupanda on July 17, 2014, 01:44:45 AM
Hey all,

I've been working for a while now to learn more about the Bitcoin source, and I'm trying to create an implementation where a number is pulled from a website and added to the wallet.

I can't seem to get this to happen any way, and I'm hoping that from a high level someone can give me some guidance.

I would love to be able to use curl, but it doesn't seem to be supported in the Bitcoin source; As well as any http retrieval method that I'm trying.

Any help is much appreciated!


Title: Re: Using curl in the Bitcoin Source
Post by: coinsolidation on July 17, 2014, 01:47:17 AM
I'm trying to create an implementation where a number is pulled from a website and added to the wallet.

and added to where exactly?



Title: Re: Using curl in the Bitcoin Source
Post by: ncsupanda on July 17, 2014, 02:00:37 AM
I'm trying to create an implementation where a number is pulled from a website and added to the wallet.

and added to where exactly?



I've got two different things I'd like to do - display a value for the current price of Bitcoin (this is similar to what you see in MultiBit) either in the toolbar or directly on the wallet itself.

Also, save the value so that an RPC can display the information in the console.


Title: Re: Using curl in the Bitcoin Source
Post by: theymos on July 17, 2014, 02:08:43 AM
See GetMyExternalIP and GetMyExternalIP2 in net.cpp, which uses an HTTP API to get your external IP. You can mostly copy GetMyExternalIP2 for your use.


Title: Re: Using curl in the Bitcoin Source
Post by: coinsolidation on July 17, 2014, 02:19:44 AM
there are also some http helper functions in rpcprotocol.cpp which may help you read the http headers and messages


Title: Re: Using curl in the Bitcoin Source
Post by: ncsupanda on July 17, 2014, 02:50:13 AM
there are also some http helper functions in rpcprotocol.cpp which may help you read the http headers and messages
See GetMyExternalIP and GetMyExternalIP2 in net.cpp, which uses an HTTP API to get your external IP. You can mostly copy GetMyExternalIP2 for your use.

Thanks, will do!