对于想了解osx10.10CURLPOST到HTTPSurl给出SSLRead的读者,本文将提供新的信息,我们将详细介绍错误,并且为您提供关于.htaccess–将httpredirect到https
对于想了解osx 10.10 CURL POST到HTTPS url给出SSLRead的读者,本文将提供新的信息,我们将详细介绍错误,并且为您提供关于.htaccess – 将httpredirect到https排除特定的url、c# – 重定向后HttpPost到ReturnURL、curl https ssl证书问题错误#35、curl post CURLOPT_POSTFIELDS的有价值信息。
本文目录一览:- osx 10.10 CURL POST到HTTPS url给出SSLRead()错误(curl post请求 https)
- .htaccess – 将httpredirect到https排除特定的url
- c# – 重定向后HttpPost到ReturnURL
- curl https ssl证书问题错误#35
- curl post CURLOPT_POSTFIELDS
osx 10.10 CURL POST到HTTPS url给出SSLRead()错误(curl post请求 https)
我最近才升级到OSX 10.10 Yosemite,由于升级,我无法再将Curl POST转换为SSL url。
我首先使用了wordpress的wp_remote_request
调用,还尝试在php中使用curl。两者(按预期)给出相同的错误消息:
错误号:56
错误字符串:SSLRead()返回错误-9806
注意:当我将POST卷曲到HTTP时,它可以正常工作。我认为这是PHP.ini或apache中的设置(升级后丢失了原始的HTTPD.conf文件…)。
谁能帮我吗?
答案1
小编典典我已经看到当使用在优胜美地下使用Apple的SecureTransport的cURL版本编译php且URL请求的目标不支持SSLv3由于[POODLE漏洞而被禁用)时,会发生此错误。该命令的输出是什么?
$ php -i | grep "SSL Version"
我怀疑您会看到以下内容:
SSL Version => SecureTransport
您可以通过安装php版本来解决此问题,该版本使用cURL版本使用OpenSSL而不是SecureTransport。使用自制程序最容易做到这一点。因此,如果尚未安装,请先安装。如果已安装自制软件,但brewupdate
自升级到优胜美地以来您还没有运行过,请首先执行此操作。还要确保您已安装XCode> =6.1和最新的XCode命令行工具。brewdoctor
会告诉您是否已正确执行操作。
在下面添加您需要的Homebrew水龙头,以安装酿造的php。如果这些存储库已被窃听,请跳过此步骤。如果不确定这些存储库是否已被窃听,请运行以下命令。最坏的情况下,您将无害Warning:Already tapped!
$ brew tap homebrew/dupes$ brew tap homebrew/versions$ brew tap homebrew/php
然后使用openssl安装curl:
$ brew install --with-openssl curl
然后使用刚安装并酿造的openssl的curl安装php:
$ brew install --with-homebrew-curl --with-httpd24 php55
如果使用apache,请确保将其添加
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
到您的计算机/etc/apache2/httpd.conf
并重新启动apache。如果不使用apache 2.4,则可以
--with-httpd24
从上述命令中删除。如果使用nginx,请按照警告说明启动fpm:
要在启动时启动php-fpm:
> mkdir -p ~/Library/LaunchAgentscp /usr/local/opt/php55/homebrew.mxcl.php55.plist
~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
安装您将需要的任何php扩展,例如。mcrypt
。
$ brew install php55-mcrypt
完成后,再次运行此命令:
$ php -i | grep "SSL Version"
而且您应该看到:
SSL Version => OpenSSL/1.0.2h
现在,重新测试您的应用程序,该应用程序将SSLRead() return error -9806
消失。
.htaccess – 将httpredirect到https排除特定的url
如何将httpredirect到https排除特定的url?
http://www.example.com/* => https://www.example.com/* http://www.example.com/nonssl/* => http://www.example.com/nonssl/*
所以我使用.htaccess文件如下:
RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} !^/nonssl/ RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
但是,当我去http://www.example.com/nonssl/testfunc ,它转到https://www.example.com/index.PHP/nonssl/testfunc 。
提前致谢。
重写问题 – L(ast)不被尊重?
将/ ch-de /中的urlredirect到/ de /并使用?redirecturl 和“
Apache Mod-Rewrite Primers?
覆盖服务器上的.htaccess文件
如何阻止通过IP访问一组url模式?
.htaccessredirect仅适用于部分url
在Apache 1.3中使用htaccess作为root用户的子目录
IP范围.htaccess文件mod_rewite
redirect需要.htaccess帮助
删除index.PHP url重写.htaccess
对于这个问题,我没有找到正确的方法,只是描述所有的服务重定向从http到https。
RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} ^/$ [OR] RewriteCond %{REQUEST_URI} ^/test [OR] RewriteCond %{REQUEST_URI} ^/test1 [OR] RewriteCond %{REQUEST_URI} ^/test2 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index.PHP|images|css|fonts|js|robots.txt) RewriteRule ^(.*)$ index.PHP?/$1 [L]
我知道这只是不推荐的方式。 如果谁能解决这个问题,就连接我吧。 谢谢。
总结
以上是小编为你收集整理的.htaccess – 将httpredirect到https排除特定的url全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
c# – 重定向后HttpPost到ReturnURL
if (!filterContext.HttpContext.User.Identity.IsAuthenticated) { filterContext.Result = new RedirectResult(String.Concat("~/Account/logon","?ReturnUrl=",filterContext.HttpContext.Request.RawUrl)); return; }
在我的登录控制器中,我验证用户凭据,然后将其签名并重定向到返回URL
FormsAuth.SignIn(userName,rememberMe); if (!String.IsNullOrEmpty(returnUrl)) { return Redirect(returnUrl); }
我的问题是,这将始终使用Get(HttpGet)请求,而我的原始提交是一个帖子(HttpPost),应该始终是一个帖子.任何人都可以建议一种传递此URL的方法,包括HttpMethod或任何解决方法,以确保使用正确的HttpMethod?
解决方法
如果您知道您向未经身份验证的用户提交的表单将POST到网站的经过身份验证的部分,那么请不要向他提供表单.请求此表单时,只需重定向到登录页面进行身份验证,并在经过身份验证后重定向到原始表单.这样,您将确保只有经过身份验证的用户才能POST到受保护资源.
就自动POST请求而言(机器人,Web服务……)将简单的401状态代码返回给不提供凭证的请求应该绰绰有余.
curl https ssl证书问题错误#35
错误的可能来源是客户端尝试使用服务器不支持的SSL3。
您可以尝试使用curl_setopt ($ch,CURLOPT_SSLVERSION,CURL_SSLVERSION_TLSv1_0);
强制使用TLS1.0,看看是否有帮助。
curl post CURLOPT_POSTFIELDS
PHP: curl_setopt - Manual http://php.net/manual/en/function.curl-setopt.php
CURLOPT_POST |
TRUE to do a regular HTTP POST. This POST is the normal application/x-www-form-urlencoded kind, most commonly used by HTML forms. |
CURLOPT_POSTFIELDS |
The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path. The filetype can be explicitly specified by following the filename with the type in the format '';type=mimetype''. This parameter can either be passed as a urlencoded string like ''para1=val1¶2=val2&...'' or as an array with the field name as key and field data as value. If value is an array, the Content-Typeheader will be set to multipart/form-data. As of PHP 5.2.0, value must be an array if files are passed to this option with the @ prefix. As of PHP 5.5.0, the @ prefix is deprecated and files can be sent using CURLFile. The @ prefix can be disabled for safe passing of values beginning with @ by setting the CURLOPT_SAFE_UPLOAD option to TRUE . |
php - CURLOPT_POST vs. CURLOPT_POSTFIELDS: Is CURLOPT_POST option required? - Stack Overflow https://stackoverflow.com/questions/26728740/curlopt-post-vs-curlopt-postfields-is-curlopt-post-option-required
I''m new to cURL in PHP. I have a question regarding usage of curl options.
Consider two script files: test1.php and test2.php both present in root www. I''m using Ubuntu 12.04 LTS. The libcurl version for PHP is 7.22.0.
Contents of test1.php
<?php
$ch = curl_init();
$post_data = array(
''firstname'' => ''John'',
''lastname'' => ''Doe''
);
curl_setopt($ch, CURLOPT_URL, ''localhost/test2.php'');
curl_setopt($ch, CURLOPT_POST, TRUE); //is it optional?
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_exec($ch);
curl_close($ch);
?>
Contents of test2.php
<?php
var_dump($_POST);
?>
When I execute test1.php via browser, I can see results posted. Now if I remove curl option containing CURLOPT_POST, the example still works. Even if I set CURLOPT_POST to false, post is performed and result is displayed. So, is that CURLOPT_POST not required at all? It looks option CURLOPT_POSTFIELDS
takes care of sending data via POST without use of CURLOPT_POST
option. When I print $_SERVER
in test2.php, request method is always set to POST
(with or without option CURLOPT_POST
).
Could anyone please let me know the exact use of CURLOPT_POST
option? Is it neccessary required for sending data via POST
?
You are correct. CURLOPT_POSTFIELDS implies CURLOPT_POST. You don''t need to use CURLOPT_POST while using CURLOPT_POSTFIELDS. The request method will always be set to POST in this case.
Note that this is in your case as long as you want it to be a POST request.
If you don''t want to be it a POST request but set CURLOPT_POSTFIELDS, please see this related Q&A:
- How to switch from POST to GET in PHP CURL
关于osx 10.10 CURL POST到HTTPS url给出SSLRead和错误的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于.htaccess – 将httpredirect到https排除特定的url、c# – 重定向后HttpPost到ReturnURL、curl https ssl证书问题错误#35、curl post CURLOPT_POSTFIELDS的相关信息,请在本站寻找。
本文标签: