Untitled
4 months ago in PHP

<?php


// Contains the url to post data
// this is my local server url
// demo is the folder name and
// demo1.php is other file

$url_path = 'http://localhost:8888/Demo/demo1.php';


// Data is an array of key value pairs
// to be reflected on the site

$data = array('Name' => 'John', 'Age' => '24');


// Method specified whether to GET or
// POST data with the content specified
// by $data variable. 'http' is used
// even in case of 'https'



$options = array(

'http' => array(

'method' => 'POST',

'content' => http_build_query($data))
);


// Create a context stream with
// the specified options

$stream = stream_context_create($options);


// The data is stored in the
// result variable

$result = file_get_contents(

$url_path, false, $stream);



echo $result;
?>
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