1<?php
2//The url you wish to send the POST request to
3$url = $file_name;
4
5//The data you want to send via POST
6$fields = [
7 '__VIEWSTATE ' => $state,
8 '__EVENTVALIDATION' => $valid,
9 'btnSubmit' => 'Submit'
10];
11
12//url-ify the data for the POST
13$fields_string = http_build_query($fields);
14
15//open connection
16$ch = curl_init();
17
18//set the url, number of POST vars, POST data
19curl_setopt($ch,CURLOPT_URL, $url);
20curl_setopt($ch,CURLOPT_POST, true);
21curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
22
23//So that curl_exec returns the contents of the cURL; rather than echoing it
24curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
25
26//execute post
27$result = curl_exec($ch);
28echo $result;
29?>
30