cURL / Mailing Lists / curl-users / Single Mail

curl-users

how to handle a callback function in curl to php

From: Robert Lefebure <robert.r.lefebure_at_gmail.com>
Date: Sun, 10 Nov 2013 20:06:13 -0500

I've never had to handle something being sent by an outside server before
and I don't know where to begin.

They give me this as an example:

curl example (url callback): curl -H "Authorization: <apikey>"
http://www.bitcoinmonitor.net/api/v1/agent/17/notification/url/ -X POST
-d"req_confirmations=3&url=http://my.shop.com/payment/"

I've set the url config of my php page at their site so I expect I change
"url=http://my.shop.com/payment/"" to what I told them. Then, I've got the
API key from them too and change that.

I don't understand their "curl -H "authentication ... etc

because all the curl I know starts with
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file);
curl_setopt($ch, CURLOPT_POST, 1);
etc

This is an example of the data I would be getting from them in the POST
body ...

{
    "signed_data": {
        "amount": 122678000,
        "userdata": "",
        "confirmations": 2,
        "amount_btc": "1.22678000",
        "address": "12r9JzPNnyWs2j1s9KLW5keqBr4kbJjxz6",
        "created": "2012-02-19 10:37:20.203541",
        "txhash":
"e0c84120068bfefddab051e751f3df963c4ed29e7b13eadac026e6f17f55fb06",
        "agent": "callback_test"
    },
    "signature": "38a25ec14b9ffcfe98938f3e35ac9cf41de2a971"
}

So basically my question is how can I get the post data (in PHP) from wjhat
they say in their example (
 curl -H "Authorization: <apikey>"
http://www.bitcoinmonitor.net/api/v1/agent/17/notification/url/ -X POST
-d"req_confirmations=3&url=http://my.shop.com/payment/" )?

Is it the CURLOPT_HEADERFUNCTION or the CURLOPT_READFUNCTION?

Thanks>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-11-11