smsbower.
online
Balance
import requests
# Replace 'YOUR_API_KEY' with your actual API key
api_key = ''
# API endpoint
url = f'https://smsbower.online/stubs/handler_api.php?
api_key={api_key}&action=getBalance'
try:
# Send a GET request to the API
response = requests.get(url)
# Check if the request was successful
if response.status_code == 200:
# Print the API response
result = response.text
if result.startswith("ACCESS_BALANCE"):
# Extract balance from response
balance = result.split(":")[1]
print(f"Your account balance is: {balance}")
elif result == "BAD_KEY":
print("Error: Invalid API key")
else:
print(f"Unexpected response: {result}")
else:
print(f"Failed to connect to API. Status code: {response.status_code}")
except Exception as e:
print(f"An error occurred: {e}")
Request Number
import requests
# Your API Key
api_key = ''
# Parameters
service = 'go' # e.g., 'go' for Google, Gmail, Youtube
country = '0' # e.g., '0' for Russian Federation
max_price = '10' # Maximum price you're ready to pay
phone_exception = '' # Exclude certain phone numbers, leave empty if not needed
ref = '' # Referral ID, leave empty if not applicable
# API endpoint
url = f'https://smsbower.online/stubs/handler_api.php?
api_key={api_key}&action=getNumber&service={service}&country={country}&maxPrice={ma
x_price}&phoneException={phone_exception}&ref={ref}'
try:
# Send a GET request to the API
response = requests.get(url)
# Check if the request was successful
if response.status_code == 200:
# Print the API response
result = response.text
if result.startswith("ACCESS_NUMBER"):
# Extract activation ID and phone number from the response
parts = result.split(":")
activation_id = parts[1]
phone_number = parts[2]
print(f"Activation ID: {activation_id}")
print(f"Phone Number: {phone_number}")
elif result == "BAD_KEY":
print("Error: Invalid API key")
elif result == "BAD_ACTION":
print("Error: Incorrect action")
elif result == "BAD_SERVICE":
print("Error: Incorrect service name")
else:
print(f"Unexpected response: {result}")
else:
print(f"Failed to connect to API. Status code: {response.status_code}")
except Exception as e:
print(f"An error occurred: {e}")
Request Code
import requests
import time
# Your API Key
api_key = ''
# Parameters for getting the number
service = 'go' # e.g., 'go' for Google, Gmail, Youtube
country = '0' # e.g., '0' for Russian Federation
max_price = '10' # Maximum price you're ready to pay
phone_exception = '' # Exclude certain phone numbers, leave empty if not needed
ref = '' # Referral ID, leave empty if not applicable
# API endpoint for getting the number
get_number_url = f'https://smsbower.online/stubs/handler_api.php?
api_key={api_key}&action=getNumber&service={service}&country={country}&maxPrice={ma
x_price}&phoneException={phone_exception}&ref={ref}'
try:
# Step 1: Get a phone number
response = requests.get(get_number_url)
if response.status_code == 200:
result = response.text
if result.startswith("ACCESS_NUMBER"):
# Extract activation ID and phone number from the response
parts = result.split(":")
activation_id = parts[1]
phone_number = parts[2]
print(f"Phone Number: {phone_number}")
print(f"Activation ID: {activation_id}")
# Step 2: Poll for SMS code using the activation ID
get_status_url = f'https://smsbower.online/stubs/handler_api.php?
api_key={api_key}&action=getStatus&id={activation_id}'
# Poll for the SMS code with a delay
while True:
status_response = requests.get(get_status_url)
if status_response.status_code == 200:
status_result = status_response.text
if status_result.startswith("STATUS_WAIT_CODE"):
print("Waiting for SMS...")
elif status_result.startswith("STATUS_WAIT_RESEND"):
print("Waiting for next SMS...")
elif status_result.startswith("STATUS_OK"):
# Extract and print the received activation code
code = status_result.split(":")[1].strip()
print(f"Activation Code: {code}")
break
elif status_result == "STATUS_CANCEL":
print("Activation canceled.")
break
elif status_result == "NO_ACTIVATION":
print("Incorrect activation ID.")
break
else:
print(f"Unexpected status response: {status_result}")
else:
print(f"Failed to check status. Status code:
{status_response.status_code}")
# Wait for 10 seconds before checking again
time.sleep(10)
elif result == "BAD_KEY":
print("Error: Invalid API key")
elif result == "BAD_ACTION":
print("Error: Incorrect action")
elif result == "BAD_SERVICE":
print("Error: Incorrect service name")
else:
print(f"Unexpected response: {result}")
else:
print(f"Failed to connect to API. Status code: {response.status_code}")
except Exception as e:
print(f"An error occurred: {e}")