PHP cURL, POST JSON

The bit that is the problem is: curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(“{categoryId: $fieldString}”)); CURLOPT_POSTFIELDS will accept either an array of parameters, or a URL-encoded string of parameters: curl_setopt($ch, CURLOPT_POSTFIELDS, array(‘json’=>json_encode($stuff))); curl_setopt($ch, CURLOPT_POSTFIELDS, ‘json=’.urlencode(json_encode($stuff))); Where json will be the name of the POST field (i.e.: will result in $_POST[‘json’] being accessible).

Install curl with openssl

Try this when you configure the libcurl ./configure –with-ssl –with-libssl-prefix=/usr/local/ssl /usr/local/ssl is where openssl contains header files and library /usr/local/ssl/ ├── bin ├── certs ├── include ├── lib ├── man ├── misc ├── openssl.cnf └── private

JSON requests in C using libcurl

The problem may be with the headers. When you are configuring your curl_slist headers I think you should assign the output of curl_slist_append back to headers: struct curl_slist *headers = NULL; headers = curl_slist_append(headers, “Accept: application/json”); headers = curl_slist_append(headers, “Content-Type: application/json”); headers = curl_slist_append(headers, “charset: utf-8”);

How to solve ‘libcurl’ not found with Rails on Windows

Answer that worked for me (W10/Ruby2.6.0) was: Download cURL from the following URL: https://curl.haxx.se/windows/ (I chose 64bit because that’s the system I’m using) Go into the archive and browse to /bin Locate libcurl_x64.dll (it may be just libcurl.dll) Extract to your local drive Rename it to libcurl.dll if it has the _x64 suffix Cut + … Read more

using libcurl without dll

There is no simple answer 🙂 Libcurl depends on other third party libs (it depends on binary distribution that you are using). As you get rid of DLL – you’ll have to link with corresponding third parties manually. Ok, so the first point is that you should not link to libcurl.lib as it binds you … Read more

curl : (1) Protocol https not supported or disabled in libcurl

Got the answer HERE for windows, it says there that: curl -XPUT ‘http://localhost:9200/api/twittervnext/tweet’ Woops, first try and already an error: curl: (1) Protocol ‘http not supported or disabled in libcurl The reason for this error is kind of stupid, Windows doesn’t like it when you are using single quotes for commands. So the correct command … Read more