标签: curl

curl:(60)SSL证书:无法获得本地颁发者证书

root@sclrdev:/home/sclr/certs/FreshCerts# curl --ftp-ssl --verbose ftp://{abc}/ -u trup:trup --cacert /etc/ssl/certs/ca-certificates.crt
* About to connect() to {abc} port 21 (#0)
*   Trying {abc}...
* Connected to {abc} ({abc}) port 21 (#0)
< 220-Cerberus FTP Server - Home Edition
< 220-This is the UNLICENSED Home Edition and may be used for home, personal use only
< 220-Welcome to Cerberus FTP Server
< 220 Created by Cerberus, LLC
> AUTH SSL
< 234 Authentication method accepted
* successfully set certificate verify locations:
*   CAfile: …
Run Code Online (Sandbox Code Playgroud)

ssl curl openssl ssl-certificate x509certificate

202
推荐指数
16
解决办法
45万
查看次数

PHP - 调试卷曲

我想在发送之前看看请求中的帖子字段是什么.(用于调试目的).

我正在使用的PHP库(类)已经完成(不是由我),所以我试图理解它.

据我所知,它用于curl_setopt()设置不同的选项,如标题等,然后curl_exec()用于发送请求.

关于如何查看发送哪些帖子字段的想法?

php debugging curl

198
推荐指数
6
解决办法
26万
查看次数

JSONDecodeError:期望值:第1行第1列(char 0)

Expecting value: line 1 column 1 (char 0)在尝试解码JSON 时遇到错误.

我用于API调用的URL在浏览器中工作正常,但在通过curl请求完成时会出现此错误.以下是我用于curl请求的代码.

错误发生在 return simplejson.loads(response_json)

    response_json = self.web_fetch(url)
    response_json = response_json.decode('utf-8')
    return json.loads(response_json)


def web_fetch(self, url):
        buffer = StringIO()
        curl = pycurl.Curl()
        curl.setopt(curl.URL, url)
        curl.setopt(curl.TIMEOUT, self.timeout)
        curl.setopt(curl.WRITEFUNCTION, buffer.write)
        curl.perform()
        curl.close()
        response = buffer.getvalue().strip()
        return response
Run Code Online (Sandbox Code Playgroud)

完全追溯:

追溯:

File "/Users/nab/Desktop/myenv2/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Users/nab/Desktop/pricestore/pricemodels/views.py" in view_category
  620.     apicall=api.API().search_parts(category_id= str(categoryofpart.api_id), manufacturer = manufacturer, filter = filters, start=(catpage-1)*20, limit=20, sort_by='[["mpn","asc"]]')
File "/Users/nab/Desktop/pricestore/pricemodels/api.py" in search_parts
  176.         return simplejson.loads(response_json) …
Run Code Online (Sandbox Code Playgroud)

python api json curl

196
推荐指数
16
解决办法
46万
查看次数

如何通过JSON文件传递有效负载?

我可以通过curl执行以下命令成功创建一个地方:

$ curl -vX POST https://server/api/v1/places.json -d "
  auth_token=B8dsbz4HExMskqUa6Qhn& \
  place[name]=Fuelstation Central& \
  place[city]=Grossbeeren& \
  place[address]=Buschweg 1& \
  place[latitude]=52.3601& \
  place[longitude]=13.3332& \
  place[washing]=true& \
  place[founded_at_year]=2000& \
  place[products][]=diesel& \
  place[products][]=benzin \
"
Run Code Online (Sandbox Code Playgroud)

服务器返回HTTP/1.1 201 Created.
现在我想将有效负载存储在JSON文件中,如下所示:

// testplace.json
{
  "auth_token" : "B8dsbz4HExMskqUa6Qhn",
  "name" : "Fuelstation Central",
  "city" : "Grossbeeren",
  "address" : "Buschweg 1",
  "latitude" : 52.3601,
  "longitude" : 13.3332,
  "washing" : true,
  "founded_at_year" : 2000,
  "products" : ["diesel","benzin"]
}
Run Code Online (Sandbox Code Playgroud)

所以我修改了要执行的命令,如下所示:

$ curl -vX POST http://server/api/v1/places.json -d @testplace.json …
Run Code Online (Sandbox Code Playgroud)

json curl

181
推荐指数
2
解决办法
21万
查看次数

如何使用cURL将文件内容作为正文实体发送

我正在使用cURL命令行实用程序将HTTP POST发送到Web服务.我想将文件的内容包含在POST的正文实体中.我已尝试使用-d </path/to/filename>类似信息的其他变体--data </path/to/filename> --data-urlencode </path/to/filename>等...文件始终附加.我需要它作为身体实体.

post curl

180
推荐指数
3
解决办法
14万
查看次数

在尝试访问HTTPS网址时如何使用cURL处理证书?

我使用curl得到以下错误:

curl: (77) error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none

如何设置此证书验证位置?谢谢.

api https curl

178
推荐指数
13
解决办法
17万
查看次数

如何在Node.js中进行远程REST调用?任何CURL?

Node.js中,除了使用子进程进行CURL调用之外,是否有办法对远程服务器REST API 进行CURL调用并获取返回数据?

我还需要为远程REST调用设置请求标头,并在GET(或POST)中也查询字符串.

我找到了这个:http://blog.nodejitsu.com/jsdom-jquery-in-5-lines-on-nodejs

但它没有显示任何POST查询字符串的方法.

rest curl node.js

178
推荐指数
8
解决办法
35万
查看次数

卷曲输出以UNIX shell脚本中的可读JSON格式显示

在我的UNIX shell脚本中,当我执行curl命令时,我的curl结果将显示如下,我将其重定向到文件:

{"type":"Show","id":"123","title":"name","description":"Funny","channelTitle":"ifood.tv","lastUpdateTimestamp":"2014-04-20T20:34:59","numOfVideos":"15"}
Run Code Online (Sandbox Code Playgroud)

但是,我希望此输出以可读的JSON格式放入文件中,如下所示:

{"type":"Show",
"id":"123",
"title":"name",
"description":"Funny",
"channelTitle":"ifood.tv",
"lastUpdateTimestamp":"2014-04-20T20:34:59",
"numOfVideos":"15"}
Run Code Online (Sandbox Code Playgroud)

请建议

shell json curl

178
推荐指数
11
解决办法
14万
查看次数

如何为curl设置请求标头?

如何在curl请求的标头中传递多个值?

curl

174
推荐指数
3
解决办法
18万
查看次数

PHP cURL无效 - Windows 7 64位上的WAMP

我在Windows 7 64bit上安装了WAMP.cURL不起作用,但我仍然从WAMP托盘启用它.

我也注释掉extension=php_curl.dllphp.ini为PHP和Apache文件夹两者.

Windows给我一个错误信息,

PHP启动:无法加载动态库'c:/wamp/bin/php/php5.4.3/ext/php_curl.dll' - 应用程序无法启动,因为它的并排配置不正确.请参阅应用程序事件日志或使用命令-lin sxstrace.exe工具获取更多详细信息."

我该如何解决这个问题?

php curl wamp

169
推荐指数
4
解决办法
13万
查看次数

标签 统计

curl ×10

json ×3

api ×2

php ×2

debugging ×1

https ×1

node.js ×1

openssl ×1

post ×1

python ×1

rest ×1

shell ×1

ssl ×1

ssl-certificate ×1

wamp ×1

x509certificate ×1