Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- $url = 'https://api.secreto.site/sendmsg';
- $data = array (
- 'id' => '2878659',
- 'message' => 'curl post PHP',
- );
- $ch=curl_init($url);
- $data_string = urlencode(json_encode($data));
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch, CURLOPT_POSTFIELDS, array("customer"=>$data_string));
- $result = curl_exec($ch);
- curl_close($ch);
- echo $result;*/
- $url = 'https://api.secreto.site/sendmsg';
- //create a new cURL resource
- $ch = curl_init($url);
- $msg = "posting pesan dengan curl";
- //setup request to send json via POST
- $data = array (
- 'id' => '2878659',
- 'message' => 'curl post PHP',
- );
- $data_string = json_encode(array("spam" => $data));
- //attach encoded JSON string to the POST fields
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
- //set the content type to application/json
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Content-Type:application/json',
- 'origin: https://secreto.site',
- 'accept-encoding: gzip, deflate, br',
- 'accept-language: en-US,en;q=0.9',
- 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36',
- ));
- //return response instead of outputting
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- //execute the POST request
- $result = curl_exec($ch);
- //close cURL resource
- curl_close($ch);
- //Output response
- echo "\n$result\n";
- //get response
- $data = json_decode(file_get_contents('php://input'), true);
- //output response
- echo $data;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement