-2

How can i send USSD code like *556# from php to any network provider like MTN,GLO or Airtel?

For instance, say I have two inputs where user can enter USSD code and Phone number. On getting to the server(PHP), the received code will be dialed on the received phone number and sent to the network provider. Is this possible?

melpomene
  • 84,125
  • 8
  • 85
  • 148

1 Answers1

0

I'm a bit late to answer this question, but just in case...

I'm not 100% sure to understand your workflow, but basically, to dial USSD codes like *556# you need to be connected on the mobile network with a mobile device (like a usb modem) and a valid SIM card. USSD implementation in modems is, by my experience, quite partial: personally I'd used Huawei 180E modems but you may want to search the internet to find more recent references that implement USSD properly.

For how to discuss with a mobile device, you might want to read this SO question/answer. Basically, your PHP code will open a serial connection on the modem, send some AT commands and wait for responses.

I don't know your objectives, but obviously, it's one concurrent session of several seconds per modem, so this is not the right solution for a usage that requires even just one query per second. If this is the case, either your telco exposes some appropriate API you may query from outside or you may negotiate a direct integration with its platforms. In both cases, it won't be for free...

mszmurlo
  • 1,250
  • 1
  • 13
  • 28