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 8242507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:11:32+00:00 2026-06-07T21:11:32+00:00

I want to HTTP POST data to a PHP file which will in-turn write

  • 0

I want to HTTP POST data to a PHP file which will in-turn write the data into a file. The script I used is as follows,

 <?php
    #error_reporting(E_ERROR | E_PARSE);
    $msglen=strlen($_POST["msgarea"]);
    $msg=$_POST["msgarea"];
    $fp = fopen("dinesh.txt", 'w');
    fwrite($fp, $msg); 
     fclose($fp); 
     echo "Data Written -> $msg";
    ?>

I am hosting this script file in sourceforge.

I have already just created the empty file dinesh.txt and placed the file in the same directory as that of the script file. But unfortunately its not written in the file.

What is the reason ?
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-07T21:11:33+00:00Added an answer on June 7, 2026 at 9:11 pm

    Check that $_POST["msgarea"] is not empty and the file is writeable for the user who tries to write it.
    And check the logs for errors of course.

    <?php
    error_reporting(E_ALL);
    var_dump($_POST["msgarea"]);
    
    $msglen=strlen($_POST["msgarea"]);
    $msg=$_POST["msgarea"];
    $fp = fopen("dinesh.txt", 'w');
    $result = fwrite($fp, $msg); 
    fclose($fp); 
    if ($result) {
        echo "Data Written -> $result";
    } else {
        echo "Error";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use this function: http://www.frankmacdonald.co.uk/php/post-to-wordpress-with-php.html Its used to post to Wordpress using
If have a html form like <form method=POST action=http://.../file.php> <input type=text name=data id=data />
I want to make a script, which could automatic edit a PHP file. For
I want to post some data via javascript to another domain. Something like: http://www.othersite.com/submitfunnyname?name=blah
I want to do a HTTP POST of the format as follows, <?xml version=1.0
Lets say my URL is: http://www.example.com/news/media-centre/news/17/an-example-news-post/?foo=bar I want to in PHP remove the last
I want to write a jQuery file uploading program, using this plug-in http://aquantum-demo.appspot.com/file-upload Despite
i am using facebook registration to send some data to a post.php file: <?php
I`m using the following code post values using JSoup: Document document = Jsoup.connect(http://www......com/....php) .data(user,user,password,12345,email,info@tutorialswindow.com)
I want to make a HTTP Post request from C#. This request has a

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.