Tag: curl

如何从Python的URL读取CSV文件?

当我做一个API调用链接http://domain.com/passkey=wedsmdjsjmdd curl 'http://domain.com/passkey=wedsmdjsjmdd' 我以csv文件格式获取员工输出数据,如: "Steve","421","0","421","2","","","","","","","","","421","0","421","2" 怎么能通过这个使用pythonparsing。 我试过了: import csv cr = csv.reader(open('http://domain.com/passkey=wedsmdjsjmdd',"rb")) for row in cr: print row 但它没有工作,我得到一个错误 http://domain.com/passkey=wedsmdjsjmdd No such file or directory: 谢谢!

如何修复curl:(60)SSL证书:无效的证书链

我得到以下错误运行curl https://npmjs.org/install.sh | sh curl https://npmjs.org/install.sh | sh在Mac OSX 10.9(小牛): install npm@latest curl: (60) SSL certificate problem: Invalid certificate chain More details here: http://curl.haxx.se/docs/sslcerts.html 我该如何解决?

在R上传超过2.15 GB的文件

我有一个手动过程,我正在上传5-6 GB的文件通过curl的Web服务器: curl -X POST –data-binary @myfile.csv http://myserver::port/path/to/api 这个过程工作正常,但我很想使用R自动化它。问题是,我要么不知道我在做什么,或者curl的R库不知道如何处理大于2GB的文件: library(RCurl) postForm( "http://myserver::port/path/to/api", file = fileUpload( filename = path.expand("myfile.csv"), contentType = "text/csv" ),.encoding="utf-8") Yeilds Error: Internal Server Error httr也不起作用: library(httr) POST( url = "http://myserver:port/path/to/api", body = upload_file( path = path.expand("myfile.csv"), type = 'text/csv'), verbose() ) 这产生: Response [http://myserver:port/path/to/api] Date: 2015-06-30 11:11 Status: 400 Content-Type: <unknown> <EMPTY […]

在PHP中使用cURL发布文件string?

我想知道是否有可能发布一个文件 – 连同其他表单数据 – 当文件只是一个string? 我知道你可以通过在文件path前加“@”来发布已经在文件系统上的文件。 不过,我想绕过创build一个临时文件,只发送文件作为string,但我不确定如何使用PHP中的cURL构造请求。 干杯 $postFields = array( 'otherFields' => 'Yes' ,'filename' => 'my_file.csv' ,'data' => 'comma seperated content' ); $options = array( CURLOPT_RETURNTRANSFER => true ,CURLOPT_SSL_VERIFYPEER => false ,CURLOPT_SSL_VERIFYHOST => 1 ,CURLOPT_POSTFIELDS => $postFields ,CURLOPT_HTTPHEADER => array( 'Content-type: multipart/form-data' ) );

如何使用curl的PATCH动词

我正在尝试对服务器进行PATCH调用。 我正在使用以下命令: curl –data status=closed -X PATCH https://api.viafoura.com/v2/dev.viafoura.com/pages/7000000043515 这是发送PATCH请求的正确方法吗? 我得到一个错误,说没有状态参数集。 我猜测–data只是POST请求,因此服务器没有find状态参数。 这是答复(FYI): {"http_status":400,"error":"Parameter validation errors","validation_errors":{"status":{"error":"Request missing status parameter."}}} 你可以在这里find关于这个服务的文档。

NTLM代理没有密码?

我使用HTTP代理工作在一个企业Windowsnetworking(我login到)。 当我使用Internet Explorer时,神奇地使用代理,而不需要input我的密码。 某些其他程序似乎也pipe理这个,就像JavaWebStart有一个“使用浏览器设置”选项。 然而,当我使用curl或wget等脚本/程序从http获取内容时,或者在我的Java代码中执行时,我似乎需要将密码存储在某处,这对于安全性来说显然不是最好的。 我怎样才能以编程方式获得Internet Explorer的无密码访问? 我认为这是一个堆栈溢出的问题,因为我是一个程序员,我需要我的程序/脚本工作,而不input密码,但我可以看到,其他人可能认为它属于服务器故障/超级用户。 我知道像curl中的–proxy-ntlm这样的设置,但是这仍然需要一个ntlm用户名和密码。

PHP的curl:我怎样才能模拟一个请求就像一个Web浏览器?

有网站,当我在浏览器上打开特定的Ajax请求我得到的结果页,但是当我尝试加载它们与curl,我收到来自服务器的错误。 我如何正确地模拟一个获取请求到模拟浏览器的服务器? 这就是我正在做的事情: $url="https://new.aol.com/productsweb/subflows/ScreenNameFlow/AjaxSNAction.do?s=username&f=firstname&l=lastname"; ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); $result=curl_exec($ch); print $result;

PHP curl HTTP PUT

我正在尝试使用cURL创build一个HTTP PUT请求,我无法使其工作。 我已经阅读了许多教程,但没有一个真正起作用。 这是我现在的代码: $filedata = array('metadata' => $rdfxml); $ch = curl_init($url); $header = "Content-Type: multipart/form-data; boundary='123456f'"; curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array($header)); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filedata)); $returned = curl_exec($ch); if (curl_error($ch)) { print curl_error($ch); } else { print 'ret: ' .$returned; } 我也尝试使用PHP梨,但得到了相同的结果。 问题是存储库说没有设置元数据。 我真的需要帮助! 谢谢!

用curl编译php,在哪里安装curl?

我需要用–with-curl=编译php时指定一个目录 curl二进制文件位于/usr/bin/curl curl -V给我 curl 7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 locate curl给我 /usr/bin/curl /usr/lib/libcurl.so.3 /usr/lib/libcurl.so.3.0.0 /usr/lib64/libcurl.so.3 /usr/lib64/libcurl.so.3.0.0 删除/ usr / share / …和其他不相关的文件 UPDATE 试过–with-curl=/usr/lib64和–with-curl=/usr/lib虽然我很确定它是64位的。 checking for cURL support… yes checking if we should use cURL for url streams… no checking for cURL in default path… not found configure: error: Please reinstall the libcurl […]

如何从CURL响应中删除HTTP头?

我有一个PHP脚本,只返回纯文本没有任何HTML。 现在我想对这个脚本做一个cURL请求,并得到以下回应: HTTP/1.1 200 OK Date: Mon, 28 Feb 2011 14:21:51 GMT Server: Apache/2.2.14 (Ubuntu) X-Powered-By: PHP/5.2.12-nmm2 Vary: Accept-Encoding Content-Length: 6 Content-Type: text/html 6.8320 真正的响应只是6.8320文本没有任何HTML。 我想通过删除标题信息从上述响应中检索它。 我已经简化了一下脚本: $url = $_GET['url']; if ( !$url ) { // Passed url not specified. $contents = 'ERROR: url not specified'; $status = array( 'http_code' => 'ERROR' ); } else […]