Repository navigation
Expand file tree
/
Copy pathpostpaypal.php
More file actions
76 lines (50 loc) · 1.41 KB
/
Copy pathpostpaypal.php
File metadata and controls
76 lines (50 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
function send_post($url, $post_data) {
$postdata = http_build_query($post_data);
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type:application/x-www-form-urlencoded',
'content' => $postdata,
'timeout' => 15 * 60 // 超时时间(单位:s)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$host = "https://www.paypal.com/cgi-bin/webscr";
$path = "/cgi-bin/webscr";
$data = $_POST;;
//$data = urlencode($data);
send_post(%host, $data);
$product_list = filter_input(INPUT_POST, 'cart_list');
// Convert JSON to array
$product_list_array = json_decode($product_list);
$result_html = '';
if($product_list_array) {
foreach($product_list_array as $p){
foreach($p as $key=>$value) {
//var_dump($key, $value);
$result_html .= $key.": ".$value."<br />";
}
//$result_html .= '------------------------------------------<br />';
}
} else {
//$result_html .= "<strong>Cart is Empty</strong>";
}
/*
header("POST $path HTTP/1.1\\r\
" );
header("Host: $host\\r\
" );
header("Content-type: application/x-www-form-urlencoded\\r\
" );
header("Content-length: " . strlen($data) . "\\r\
" );
header("Connection: close\\r\
\\r\
" );
header($data);
*/
?>