libcurl

Upload large files to WebDAV with resume support

假如想象 提交于 2019-12-10 12:04:14
问题 I want to upload large files to ownCloud with WebDAV API. I use this code to do this: <?php $url = "http://user:password@owncloud.local/remote.php/webdav/test.mp4"; $localfile = "test.mp4"; $fp = fopen ($localfile, "r"); $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_PUT, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_INFILE, $fp); curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));

How do I build libcurl for 64-bit Windows in/using Visual Studio 2010?

回眸只為那壹抹淺笑 提交于 2019-12-10 10:57:14
问题 So initially, I followed the instructions of BUILD.WINDOWS.txt and I was able to get libcurl building 32-bit by creating a new file winbuild.bat and placing it in the root directory of my curl folder: CALL "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat" CD winbuild DEL CURL_OBJS.inc DEL LIBCURL_OBJS.inc DEL vc100.idb nmake /f Makefile.vc mode=dll VC=10 ENABLE_WINSSL=yes GEN_PDB=yes MACHINE=X86 CD .. EXIT /B 0 I then went to File / New / Project from Existing Code...

PHP Curl progress bar (callback returning percentage)

独自空忆成欢 提交于 2019-12-10 09:33:10
问题 I have implemented the curl progress bar using curl_setopt($curl, CURLOPT_PROGRESSFUNCTION, 'callback'); curl_setopt($curl, CURLOPT_BUFFERSIZE,64000); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); and a callback function. problem is, the script is outputting the percentage on my html everytime like this : 0 0.1 0.2 0.2 0.3 0.4 .. .. .. 1 1.1 How do i combine this with CSS to show a changing progress bar ? 回答1: Suppose you have a progress bar HTML: <div id="progress-bar"> <div id="progress

libcurl CURLE_SSL_CACERT_BADFILE error on android

巧了我就是萌 提交于 2019-12-10 03:59:41
问题 So I'm trying to use libcurl with JNI but it returns CURLE_SSL_CACERT_BADFILE error. This is my code. JNI side: static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) { ((string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; } //jList is an array containing the certificate. Java_packageName_MainActivity_Test(JNIEnv *env, jobject thiz, jobject jList) { vector<string> certificatesPinning; // Convert jobject to jobjectArray // retrieve the java

cURL - put output into variable?

江枫思渺然 提交于 2019-12-10 01:44:43
问题 I'm currently using this C code: CURL *curl; CURLcode res; curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://my-domain.org/"); res = curl_easy_perform(curl); curl_easy_cleanup(curl); } It prints the output on the console. How can I get the same output, but read it into, say, a string? (This is a probably a basic question, but I do not yet understand the libcurl API...) Thanks for any help! Mike 回答1: You need to pass a function and buffer to write it to buffer. /

How to install libcurl with nss backend in aws ec2? (Python 3.6 64bit Amazon Linux)

梦想的初衷 提交于 2019-12-09 18:49:35
问题 I have an ec2 instance in AWS running Python3.6 (Amazon Linux/2.8.3) where I need to install pycurl with NSS ssl backend . First I tried it by adding pycurl==7.43.0 --global-option="--with-nss" to my requirement.txt file but I was getting errors installation errors. So I ended up doing it by adding a .config file in .ebextensions (that runs during deployment): container_commands: 09_pycurl_reinstall: # the upgrade option is because it will run after PIP installs the requirements.txt file. #

Google API - request for token from Oauth2 returns “invalid_request”

拜拜、爱过 提交于 2019-12-09 16:12:19
问题 I am trying to make an app using Google's calendar API. I'm following the directions here. I can make the request to get the authorization code, but I can not seem to form a valid request to get an access token. I keep getting the response {"error" : "invalid_request"} . This is the POST request I am making: POST /o/oauth2/token HTTP/1.1 Host: accounts.google.com Content-Type: application/x-www-form-urlencoded code=4/vxQqw9JMYEnXvI8A_93OV7kBSg6h.8r2yJUkMc18dshQV0ieZDAraZNwsbwI& client_id=[my

How to use libcurl for HTTP post?

为君一笑 提交于 2019-12-09 16:08:31
问题 I am new using libcurl. I am not understanding clearly how to use it for HTTP POST requests and how to check the result. How can I use it for this? 回答1: Refer the manual page for documentation the -d option. You can use that multiple times to pass different key,value pairs to the server. Once that works, use the --libcurl flag to see what it would look like if you're trying to use libcurl to manually do this in your application. 回答2: #include <curl/curl.h> main() { CURL *curl; curl_global

How to save image using libcurl

为君一笑 提交于 2019-12-09 12:09:49
问题 I wanted to use libcurl for a project which involves getting an image from a webpage. The URL looks like this: http://xxx.xxx.xxx.xxx/cgi-bin/anonymous/image.jpg Using command-line cURL I can retrieve the image using $curl -o sampleimage.jpg http://xxx.xxx.xxx.xxx/cgi-bin/anonymous/image.jpg I want to know the equivalent of this code in libcurl because I'm getting nuts right now. I got this sample source on the net, and it compiles and stuff, but I can't see the image file anywhere. This is

CURL with PHP - Very slow

筅森魡賤 提交于 2019-12-09 05:28:16
问题 All, I have to request a URL which returns a JSON request. I am using PHP and CURL to do this. Currently it takes around 3-4 seconds for the request and response. Following is the curl code $ch = curl_init(); $devnull = fopen('/tmp/curlcookie.txt', 'w'); curl_setopt($ch, CURLOPT_STDERR, $devnull); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $desturl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL