curl

How to get data from a website that uses SSL using cURL and PHP?

微笑、不失礼 提交于 2021-02-05 11:34:26
问题 I am trying to get some data from a website where you need to have a SSL certificate to be able to connect to it. I have found the following code : // create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, $host); //return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, $host); // $output contains the output string $output = curl_exec($ch); // close curl resource to free up system resources curl_close($ch); The cURL query works well, but the data

C++ cUrl send an image buff to telegram bot via api

China☆狼群 提交于 2021-02-05 10:02:07
问题 I'm trying to send an image buff with cUrl to the telegram API using c++. Just to know I' m developing on Windows 10. Here is all I have done. First I send a photo from my hard drive using curl from terminal using this command: curl -s -X POST "https://api.telegram.org/bottoken/sendPhoto" -F chat_id=id -F photo="@D:/a.jpg" On the telegram chat I receive the photo with this command meanwhile on the console in which I did the cUrl request I have a response like this: {"ok":true,"result":{

C++ cUrl send an image buff to telegram bot via api

只谈情不闲聊 提交于 2021-02-05 10:01:11
问题 I'm trying to send an image buff with cUrl to the telegram API using c++. Just to know I' m developing on Windows 10. Here is all I have done. First I send a photo from my hard drive using curl from terminal using this command: curl -s -X POST "https://api.telegram.org/bottoken/sendPhoto" -F chat_id=id -F photo="@D:/a.jpg" On the telegram chat I receive the photo with this command meanwhile on the console in which I did the cUrl request I have a response like this: {"ok":true,"result":{

unable to get local issuer certificate even with bundle installed

被刻印的时光 ゝ 提交于 2021-02-05 08:23:06
问题 I know something similar to this has already been asked around here but I think my problem is different. I'm trying to make a curl request to a propper SSL website (its not self-signed). I can set the options easily and even imported the CA certificate bundle to the right place. All fine and good I would hope but I'm still getting : SSL certificate problem: unable to get local issuer certificate I've looked around here and on google and can't seem to solve the issue. Here's my curl setup: $ch

Multiple read from a txt file in bash (parallel processing )

一世执手 提交于 2021-02-05 05:57:53
问题 Here is a simple bash script for HTTP status code while read url do urlstatus=$(curl -o /dev/null --silent --head --write-out '%{http_code}' "${url}" --max-time 5 ) echo "$url $urlstatus" >> urlstatus.txt done < $1 I am reading URL from text file but it processes only one at a time, taking too much time, GNU parallel and xargs also process one line at time (tested) How to process simultaneous URL for processing to improve timing? In other words threading of URL file rather than bash commands

cURL Error (35): error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 unrecognized name

送分小仙女□ 提交于 2021-02-05 05:00:25
问题 I have been using the following code block to collect data from a HTTPS website using cURL. $q = 'https://www.example.org/'; // for example $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $q); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); $json = curl_exec($ch); cURL shows the following error error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1

Convert CURL to URLRequest

无人久伴 提交于 2021-02-04 19:46:06
问题 I’m trying to converting the the following curl request Swagger gives me to URLRequest: curl -X GET --header 'Accept: application/json' --header 'Authorization: key ttn-account-v2.<app-key>' 'https://<app-id>.data.thethingsnetwork.org/api/v2/query' URL and Headers are set correctly. Still I get the response: 401 - Not authorized. let key = "ttn-account-v2.<app-key>" let url = URL(string: "https://<app-id>.data.thethingsnetwork.org/api/v2/query") var request = URLRequest(url: url!) request

Curl cannot verify wildcard SSL certificate issued by Verisign

心不动则不痛 提交于 2021-02-04 19:22:31
问题 I have a script that needs to use cURL to securely connect to a web site, foo.bar.com that is covered by a wildcard SSL certificate for *.bar.com. The wildcard certificate is issued by Verisign, and all browsers trust it without any problem. However, I cannot get PHP / cURL to connect (at least not without disabling certificate verification). Just for the sake of isolating the problem, I tried to connect using just command-line cURL (version 7.21.1). I downloaded an updated CA bundle from

Curl cannot verify wildcard SSL certificate issued by Verisign

南楼画角 提交于 2021-02-04 19:22:00
问题 I have a script that needs to use cURL to securely connect to a web site, foo.bar.com that is covered by a wildcard SSL certificate for *.bar.com. The wildcard certificate is issued by Verisign, and all browsers trust it without any problem. However, I cannot get PHP / cURL to connect (at least not without disabling certificate verification). Just for the sake of isolating the problem, I tried to connect using just command-line cURL (version 7.21.1). I downloaded an updated CA bundle from

curl with ntlm authentication works in command line but not inside php

别等时光非礼了梦想. 提交于 2021-02-04 18:40:08
问题 I have to connect from a Centos Host to a IIS with curl. Using curl with --ntlm option works fine on the command line, but non in php. Server is a Microsoft IIS and answers first with 401 Unauthorized, on second pass with 200 OK. After investigating for several hours i did not find a working solution.. When i use curl on the command line (centos 6.4) to retrieve the content of a service: curl -v http://example.com/do.asmx --ntlm -u DOMAIN\\username:password the server answers successfully