Question

Tried to use ACRA in my app, but I can't get the google drive or the email working (in google drive I don't know how to create the form from the template, email tells me there is no such email address even though I am sending from the same email address). I would rather get the google drive spreadsheet thing working or better yet - if there is a ready-to-use script for free web host that I can use to get the reports. Anyone knows of such a script?

EDIT: I need a php one...

Was it helpful?

Solution

Looks like ACRA uses a simple post. What language do you need it in? For asp.net:

    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder err = new StringBuilder();
        foreach (string name in Request.Form)
        {
            err.AppendLine(name + ": " + Request.Form[name]);
        }

        TextWriter tw = null;
        try
        {
            tw = new StreamWriter("f:\\errorLogs\\error_" + DateTime.Now.Ticks + ".txt");
            tw.WriteLine(err.ToString());
        }
        catch (Exception) { }
        finally
        {
            if(tw != null)
                tw.Close();
        }
    }

Since you are using a "free web host", the location probably isn't valid for you, but this should at least get you pointed in the right direction. There is another post which is similar to yours. Most free web hosts use php.

EDIT:

Here is a basic PHP script (Not tested, but seems OK to me. My PHP is a bit rusty):

<?php
$file = 'postData.txt';
$arr= $_POST;
$fp = fopen($file, 'w') or die('Could not open file!'); 
foreach ($arr as $key => $value) {
    $toFile = "Key: $key; Value: $value \n";
    // write to file 
    fwrite($fp, "$toFile") or die('Could not write to file'); 
}
// close file 
fclose($fp);
?> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top