0

I want to fetch data from post web service after setting some parameters in header of that url. I have php code that works fine that sample php code is

$headers = array(
    'fname': 'curl',
    'lname': 'header',
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

Setting a header in android seem to be issue. Sample android code is

String [] headers = {
        "fname:curl",
        "lname:header"
};

curl_setopt(curl, CURLOPT_URL, url);
curl_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt(curl, CURLOPT_HEADER, 0);
curl_setopt(curl, CURLOPT_HTTPHEADER, headers );

Any suggestion how can i set header properly in android.

2
  • So the first snippet is PHP. What is the second one? Mar 21, 2014 at 12:14
  • @DanielStenberg Second Android code to set header Mar 21, 2014 at 12:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.