php curl post redirect
发布时间:2020-12-13 15:56:02 所属栏目:PHP教程 来源:网络整理
导读:我试图整合银行api进行重定向支付. 我使用curl post方法,但我希望能够在帖子后跟随重定向. 这是我的代码 curl_setopt($ch,CURLOPT_URL,'https://paycenter.piraeusbank.gr/redirection/pay.aspx'); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); curl_set
我试图整合银行api进行重定向支付.
我使用curl post方法,但我希望能够在帖子后跟随重定向. 这是我的代码 curl_setopt($ch,CURLOPT_URL,'https://paycenter.piraeusbank.gr/redirection/pay.aspx'); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch,CURLOPT_CUSTOMREQUEST,"POST"); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch,CURLOPT_POSTFIELDS,array( 'data' => $data )); $content = curl_exec($ch); 在帖子之后它认为我必须被重定向在一个网址中 https://paycenter.piraeusbank.gr/redirection/4234sgsfdgfsg/pay.aspx 而不是重定向到: http://mytestdomain.org/redirection/4234sgsfdgfsg/pay.aspx 这显然最终导致404错误 解决方法
您需要操纵您的响应,然后编写硬代码以将此脚本重定向到特定页面,因为curl会在您的服务器上执行该url.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |