duangu8264 2015-05-19 07:28
浏览 67

php curl post redirect

Im trying to integrate a bank api for redirect payment. Im using curl post method but i want to be able to follow the redirect after the post. Here is my code

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);

After the post it supposed that i have to be redirected in a url like

https://paycenter.piraeusbank.gr/redirection/4234sgsfdgfsg/pay.aspx

Instead of that im redirecting to:

http://mytestdomain.org/redirection/4234sgsfdgfsg/pay.aspx

which obviously ends up in 404 error

  • 写回答

2条回答 默认 最新

  • dou47278 2015-05-19 07:33
    关注

    You need to manipulate your response and then write hard code to redirect this script to particular page as curl execute that url on your server.

    评论

报告相同问题?

悬赏问题

  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条