<?php

namespace Tool\MakeLocustRequestFile\Util;

use Tool\MakeLocustRequestFile\Config\Config;

class HttpUtil
{

    public function httpPost(string $packet_str)
    {
        $curl = curl_init(Config::GAME_URL);
        $options = array(
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => $packet_str,
            CURLOPT_HEADER => false,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_TIMEOUT => 3
        );
        curl_setopt_array($curl, $options);
        $response = curl_exec($curl);
        curl_close($curl);
        return $response;
    }

}


