Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过XML发送php表单,并将响应保存为cookie_Php_Xml_Forms - Fatal编程技术网

通过XML发送php表单,并将响应保存为cookie

通过XML发送php表单,并将响应保存为cookie,php,xml,forms,Php,Xml,Forms,我想使用一个包含两个字段的php表单: 电子邮件/密码并通过XML将其发送到第三方站点,然后它将返回一个XML响应,我希望捕获名称并在标题上的另一个位置回显(我正在考虑将其保存为cookie,但我不确定最佳方式)。 下面是我正在尝试的代码,但我无法判断它是否有效,因为我没有捕获响应 echo'<form name="ppost" method="post" action="'.$_SERVER['PHP_SELF'].'"> <input type="text" name="

我想使用一个包含两个字段的php表单:

电子邮件/密码并通过XML将其发送到第三方站点,然后它将返回一个XML响应,我希望捕获名称并在标题上的另一个位置回显(我正在考虑将其保存为cookie,但我不确定最佳方式)。 下面是我正在尝试的代码,但我无法判断它是否有效,因为我没有捕获响应

echo'<form name="ppost" method="post" action="'.$_SERVER['PHP_SELF'].'">

<input type="text" name="emailaddress" />
<input type="text" name="password" />
<input type="submit" name="SUbmit" value="Submit" />

</form>';


extract($_POST);

 $n = "\n\n";
 $inputdata = '<?xml version=\'1.0\' encoding=\'UTF-8\'?'.'>'.$n.'
<CustomerCredential  xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<EmailAddress>'.$emailaddress.'</EmailAddress>
<Password>'.$password.'</Password>

</CustomerCredential>';


$x = curl_init("https:AnotherWebsite.com/CustomerSession");
curl_setopt($x, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($x, CURLOPT_HEADER, 0);
curl_setopt($x, CURLOPT_POST, 1);
curl_setopt($x, CURLOPT_POSTFIELDS, $inputdata);
curl_setopt($x, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($x, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($x);
curl_close($x);
echo $data; 
echo'
';
摘录(元);;
$n=“\n\n”;
$inputdata=''.$n.'
“.$emailaddress。”
“.$password。”
';
$x=curl_init(“https:AnotherWebsite.com/CustomerSession”);
curl_setopt($x,CURLOPT_HTTPHEADER,array('Content-Type:text/xml'));
curl_setopt($x,CURLOPT_头,0);
curl_setopt($x,CURLOPT_POST,1);
curl_setopt($x,CURLOPT_POSTFIELDS,$inputdata);
curl_setopt($x,CURLOPT_FOLLOWLOCATION,0);
curl_setopt($x,CURLOPT_RETURNTRANSFER,1);
$data=curl\u exec($x);
卷曲关闭(x美元);
回波数据;

漂亮的XSS孔。。。希望没有人的密码中有
。@roje0931:始终验证和清理用户输入。