我想知道是否有人可以帮助我,因为我会为此疯狂。我正在与一家公司合作,在该公司中,我需要向返回URL的服务器提交表单帖子数据。我想将用户重定向上述链接。
以下是返回URL
的PHP<?php
$interface = "";
$postFields = Array(
"action" => "credit_application_link",
"Identification[api_key]" => "",
"Identification[InstallationID]" => "",
"Identification[RetailerUniqueRef]" => "",
"Goods[Description]" => "",
"Goods[Price]" => "",
"Finance[Code]" => "",
"Finance[Deposit]" => ""
);
function httpPost($interface, $postFields)
{
$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_URL, $interface);
curl_setopt($curlSession, CURLOPT_HEADER, 0);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curlSession, CURLOPT_POST, 1);
curl_setopt($curlSession, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlSession, CURLOPT_TIMEOUT, 180);
curl_setopt($curlSession, CURLOPT_FOLLOWLOCATION, 1);
$curl_response = curl_exec($curlSession);
return $curl_response;
}
echo $response = httpPost($interface, $postFields);
经过一项研究,似乎是一个标题位置可能是这样做的方法,但是由于每次我有点卡住了URL。
希望这是有道理的,并感谢您的任何帮助!
假设您有2个文件
- post.php(您将从这里开始卷曲)
- response.php(您将从卷曲中击中此URL,它将用动态URL返回响应)
在post.php
$response = httpPost($interface, $postFields);
$response = json_decode($response,true);
header('Location: '.$response['url']);
在response.php
$data['url'] = "tranxactive.com";
return json_encode($data);
其中
$interface = "response.php";
希望这个详细的答案可以帮助