Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8882137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:30:08+00:00 2026-06-14T20:30:08+00:00

All, I have an SMS gateway application running on my server that passes incoming

  • 0

All,
I have an SMS gateway application running on my server that passes incoming SMS messages to a php script. That script writes the data to a text file. Certain aspects of the message can be extracted as variables – for example: Message content: $msgdata Sender: $originator Time: $receivedtime etc…
Using the script below I can easily write the message to a text file but it will write the data of every SMS that comes in. I only want to write to a text file if the $originator variable is a certain telephone number (e.g 07123456321)

$date = date("d.m.Y H:i:s");
$msgdata = $_REQUEST["msgdata"]; 
$myFile3 = "test.txt";
$fh = fopen($myFile3, 'a') or die("can't open file");
$stringData3 = "$date - $msgdata\n";
fwrite($fh, $stringData3);
fclose($fh);

Your assistance is bery much appreciated.
Many thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:30:09+00:00Added an answer on June 14, 2026 at 8:30 pm

    Since you can not do print_r for incoming messages you can frite $msgdata = $_REQUEST[“msgdata”]; to your txt file.
    Then all you have to do is to open txt file and take a look at $originator key and then said:

     if($msgdata->originator_key == '07123456321'){
          //your function for writing to file here
       }
    

    If I understood correctly the question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have class that extends BroadcastReceiver and gets all new sms. When I get
I'm writing an application to receive SMS messages via an HTTP gateway. The main
I have been developing the application which must catch all input sms. For it
I'm developing a web site which will retrieve SMS messages that have been sent
I have a ListView showing all incoming sms. What I want to do is
I have an app that sends SMS - so GooglePlay filters all devices that
I have an application which should watching incoming SMS (scan SMS text and show
I'm able to read SMS Inbox and display all messages. I have two problems.
I have to count all sent text messages (SMS) by user or by some
I have this situation: I have to create a dataset that takes all data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.