Articles of curl

cURL在web服务器中存储文件的位置?

我有一台使用nginx web服务器的centOS机器。 在我的应用程序(php)中,我使用cURL来获取远程文件,然后将其发送到视图: $cache_expire = 60*60*24*365; header("Pragma: public"); header("Cache-Control: maxage=". $cache_expire); header('Expires: ' . gmdate('D, d MYH:i:s', time() + $cache_expire).' GMT'); $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $REMOTE-FILE-URL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $img = curl_exec($ch); curl_close($ch); echo $img; 我想知道,cURL需要下载文件到我的服务器的某个地方的tmp / cache文件夹吗? 这个文件夹在哪里? 稍后删除文件,或者我必须在一段时间内清理文件夹?

SSL客户端证书和NginX

我按照这个博客文章的指示,但是当我用curltesting它时,nginx的$ssl_client_verifyvariables总是NONE 。 实际上,当我没有指定–cert和–key选项的时候, curl甚至没有提供不同的输出。 就好像它忽略了我的证书。 我怎样才能debugging呢? 我甚至尝试过让所有这些地方都具有相同的价值: CA和服务器证书上的通用名称 服务器的主机名 NginX的虚拟主机名 服务器的反向DNS名称

在子文件夹中启用curl_exec()

Curl在服务器上启用,但curl_exec函数由于安全原因被禁用。 disable_functions = exec,passthru,shell_exec,system,proc_open,popen, curl_exec,curl_multi_exec,parse_ini_file,show_source 我知道我可以从php.ini启用这个function,但会影响整个服务器。 你能帮我build议如何激活这个function(curl_exec)只为一个特定的子文件夹? 我尝试使用.htaccess但没有运气。

“curl:(7)无法连接到主机”只能在www。 子域名

我正在使用Centos 6和Plesk 11运行服务器。 我curl安装和工作的所有域名,除了一个域名有www。 作为首选的域名。 [root@www]# curl http://www.exampledomain.com/wp-admin/admin-ajax.php curl: (7) couldn't connect to host 当我删除www。 它连接,但自然应该被redirect。 [root@www conf]# curl http://exampledomain.nl/wp-admin/admin-ajax.php <html> <head><title>301 Moved Permanently</title></head> <body bgcolor="white"> <center><h1>301 Moved Permanently</h1></center> <hr><center>nginx</center> </body> </html> 出现这个问题,我得到了一个WordPress插件的错误,告诉我Http Loopbacks不工作。 编辑: [root@www ~]# curl -v http://www.exampledomain.nl/wp-admin/admin-ajax.php * About to connect() to www.exampledomain.nl port 80 (#0) * Trying 127.0.0.1… Connection refused * […]

yum不包含这个包:libcurl

我在Redhat 5中,找不到以下软件包 yum -y install libcurl libcurl-devel Loaded plugins: security Setting up Install Process No package libcurl available. No package libcurl-devel available. Nothing to do 奇怪的! 我在这里错过了什么?

Fedora 22 DNF超时

我只是安装Fedora 22和DNF(百胜的替代品)performance糟糕。 10个请求中有9个未超时,具有指定IPv4的随机效应。 这个问题似乎是DNF不能select一个适当的镜像和经常select一个不响应的镜像,或者是一个非常慢的镜像。 Feil: Error downloading packages: Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=updates-released-f22&arch=x86_64 [Could not resolve host: mirrors.fedoraproject.org] 另外,我认为IPv6是一些麻烦,所以它已经停用在我的系统上。 重新启动dosn't改变任何东西…

为什么我无法使用curl以HTTP方式连接到我的网站?

我有一个网站www.eshipp.com,所有的域名都被SSL保护,所以任何HTTPstream量都被NGINXredirect到与HTTPS相同的URL。 但是,似乎有些用户没有redirect,然后得到一个“不可访问的”http错误。 由于我自己在浏览器上没有错误,所以很难debugging,但是我很幸运地发现使用Curl会发生这样的错误: $ curl -v http://eshipp.com/ * Hostname was NOT found in DNS cache * Trying 198.199.96.110… * connect to 198.199.96.110 port 80 failed: Connection timed out * Failed to connect to eshipp.com port 80: Connection timed out * Closing connection 0 curl: (7) Failed to connect to eshipp.com port 80: Connection timed out […]

为什么nginx提供200 OK响应,即使域不在我的服务器上? 我该如何解决?

我已经在ip 123.123.123.123的nginx web服务器上托pipeexample.com,如果我从远程机器使用像这样的主机头curl curl -v -H "Host: example.com" 123.123.123.123/ 我明白了 curl -v -H "Host: example.com" 123.123.123.123/ * Trying 123.123.123.123… * Connected to 123.123.123.123 (123.123.123.123) port 80 (#0) > GET / HTTP/1.1 > Host: example.com > User-Agent: curl/7.43.0 > Accept: */* > < HTTP/1.1 200 OK < Server: nginx/1.9.9 < Date: Tue, 15 Dec 2015 01:34:22 […]

为什么不能curl检索SSH主机密钥(key:<none>)

我一直在使用curl(通过git-ftp)一段时间,只传递用户名和sftp URL。 身份validation将始终隐式通过publickey工作。 突然curl将不再通过SSH连接 – 显然是因为它没有得到一个主机密钥,因此拒绝连接: Trying {IP}… * Connected to host.example.com ({IP}) port 22 (#0) * SSH MD5 fingerprint: {Fingerprint} * SSH host check: 2, key: <none> * Closing connection 0 为什么不能卷起钥匙? 连接与ssh -v工作,并给我2主机键,也curl –insecure将工作。

来自Apache服务器的奇怪的302响应

我有这种情况完全让我感到困惑: 设置 一个新设置的服务器(centos 7,apache,mysql,没什么奇怪的),它提供了一个简单的php应用程序,我需要在另一台服务器上与我的主应用程序进行交互。 这个服务被设置为在service.name.domain.tld上运行,而主应用程序在domain.tld上(只是提及以防万一)。 问题 由于某些原因,当我尝试从主服务器访问服务应用程序时,我得到了一个无限循环的302redirect。 如果我从主服务器上执行curl -D – http://service-name.domain.tld ,我会得到: HTTP/1.1 302 Found Date: Wed, 03 Aug 2016 12:30:26 GMT Server: Apache Location: http://service-name.domain.tld Content-Length: 218 Connection: close Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="http://email-blasts.upgradesale.co">here</a>.</p> </body></html> 如果我从我的电脑执行相同的命令,结果是 HTTP/1.1 200 OK […]