Javascript Alter Server Side File

i have a blogspot.com blog and want to be able to play a sound locally on my computer whenever the blog is visited.  i use google analytics to record web traffic and google analytics had me place the following code right before the </body> tag:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-3173439-1";
urchinTracker();
</script>

can i do something similar with a javascript file on my local web server?  i want whenever someone visits my blog for the text file (on my local web server) contents to be incremented by one.  i have a local VB6 program running on my local webserver that monitors that text file and whenever it detects a change it plays a wave file.

thanks!
jasdakAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

b0lsc0ttIT ManagerCommented:
jasdak,

Not with Javascript alone.  To modify the file on your web server you need server script or some server "program" to do it.  Usually this is server script.  Can you use a server script like ASP, PHP, Perl, etc?  If so, which?  That would then be used to access the file and increment the number.  The reason the Google stuff works is it is tied to server script too.

Let me know if you have any questions or need more information.

b0lsc0tt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jasdakAuthor Commented:
i can do php serverside.  i found a way to do it by monitoring apache's access.log file and look for specific GET requests for certain jpeg photos.  but that requires parsing a 9mb file quite often.  if you have suggestions of how to do this by simply creating/updating a txt file with a single value that'd be great.  thanks!
0
b0lsc0ttIT ManagerCommented:
I can help with the PHP script.  I have one question though.  The script needs to be in the page that shows the blog.  It wouldn't work if the file isn't called as part of the process to visit the blog.

Before working on script I just wanted to make sure this method would work for what you have.  Let me know if you have a question.  If it will work then any details you can provide will help me make the script more accurate (e.g. filename, location, etc).

bol
0
jasdakAuthor Commented:
my blog is at blogspot.com and as far as i know they do not allow php on their pages.  i can add whatever html i want though.  my personal webserver does php fine with apache.  so if this scenario works, that'd be great if you could show me how.  either way though i'll give you the points since you are so helpful and quick.  thanks!

if you can show me code to do it, that'd be great.
0
b0lsc0ttIT ManagerCommented:
With the blog on a different server you wouldn't be able to use PHP to directly change something on your server so it doesn't matter that PHP isn't supported.

Since you can modify the html on blogspot then you might be able to run Javascript on that page or add a hidden iframe.  This assumes blogspot won't try to prevent certain tags or scripts like many sites do.

For you to use a Javascript method you would add a tag like the one below to the head of your blogspot page, one the visitor would view.

<script type="text/javascript" src="http://yourPHPserver/folder/file.js"></script>

That js file would have script to call the PHP script on your site or notify your server in some way.

For the iframe method you would use the src tag to call the PHP script file on your server.  The tag would look like the one below and be somewhere in the body.

<iframe name="frame1" src="http://yourPHPserver/folder/file.php" style="display: none;"></iframe>

An example and good explanation of the PHP to use for working (i.e. creating, reading, modifying) a file can be found at http://www.tizag.com/phpT/filecreate.php and the pages before and after it (see the links to the left).  This would use PHP to do it but you may also have other options with some server object, etc.

I'm glad I was able to help and I hope this adds a bit more.  If you want more and post a new question then feel free to let me know by posting the new question's URL here.  Thanks for the grade, the points and the fun question.

bol
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.