ESP8266 WIFI_AP_STA with internet

I’m trying to setup an access point with my ESP8266 to broadcast internet with the following code:

#include <ESP8266WiFi.h>

WiFiServer server(80);

const char *ap_ssid = "SAP";
const char *ap_password = "11112222";
const char *sta_ssid = "SSIDwithinternet"; 
const char *sta_password = "SSIDwithinternetPASS";

void setup() {
  Serial.print("Connecting to ");
  WiFi.begin(sta_ssid, sta_password);

  while (WiFi.status() != WL_CONNECTED) {

  Serial.println("WiFi connected");
  Serial.println("IP address: ");

  Serial.println("Configuring access point...");
  WiFi.softAP(ap_ssid, ap_password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");


void loop() {

However, when I connect to the access point with my phone or laptop, there is no internet. Am I missing something here?

The monitor shows the following:

Configuring access point...
AP IP address:
Connecting to Connect4G
WiFi connected
IP address:

hi matrixall,

very new to this stuff,,,Arduino,,,but am guessing you need to setup your esp8266 as a repeater ,,,rather than AP mode, to your exisitng wifi router. If this is your setup,,,you are using? There is a simple sketch for setup repeater mode, FYI.

Thanks for the replay, I'm new indeed. I'm planning to run WIFI_AP_STA to be a central AP that fetch data from my website to feed other ESP's (Clients) which control relays and sensors. I'm not sure if the repeater would be able to communicate with clients the same way or maybe even better. Appreciate your help.