bota

Bota - the ultimate Telegram bot hosting built with PHP, powered by NovaGram Library!

View the Project on GitHub Jobians/bota

HTTP Request

The HTTP class provides a simple way to make HTTP requests and send emails via a RESTful API.

Usage

To use the HTTP class, follow these steps:

  1. Make a GET request:
     $url = 'https://example.com/api/get';
     $headers = [
         'Authorization: Bearer myToken'
     ];
     $response = $HTTP->get($url, $headers);
    
  2. Make a POST request:
     $url = 'https://example.com/api/post';
     $data = [
         'name' => 'John Doe',
         'email' => 'johndoe@example.com'
     ];
     $headers = [
         'Authorization: Bearer myToken'
     ];
     $response = $HTTP->post($url, $data, $headers);
    
  3. Send an email:
     $data = [
         'sender' => 'yourgmail@gmail.com',
         'password' => 'your_gmail_app_password',
         'recipient' => 'recipient@example.com',
         'subject' => 'Hello',
         'message' => 'This is a test email'
     ];
     $response = $HTTP->sendMail($data);
    

Methods

post($url, $data, $headers = [])

Sends a POST request to the specified URL.

Parameters:

Returns:

get($url, $headers = [])

Sends a GET request to the specified URL.

Parameters:

Returns:

sendMail($data)

Sends an email using the specified data.

Parameters:

Returns: