Sign in | Sign up

Specify Fields cURL & PHP

Tagged:

Currently contains 2 posts

Avatar

May 06, 2014 15:18

SarahOS92

How do I specify certain fields in the following format?

curl_setopt($ch, CURLOPT_POSTFIELDS,
“appId=APPID&appKey=APPKEY&query=milk”);

I tried;
curl_setopt($ch, CURLOPT_POSTFIELDS,
“appId=APPID&appKey=APPKEY&query=milk&fields=item_name, nf_calories”);
But, I get a “fields must be a JSON array” error. Any suggestions?

Avatar

May 07, 2014 18:35

Matt Silverman

Sorry, we are not able to give programming language specific support. It appears that you have an issue with your general PHP syntax. Please check out this PHP library for reference as well:
https://github.com/nutritionix/api-library-php

Reply to thread