Write ajax variable to txt file with php


down vote


I have a facebook application coded client side and I want to store the tokens on my server for later use

There is a variable called 'token' and I then create a new function called 'apple' to write this variable in a json format to a txt file



//access token stuff

var token = $("#link_input").val();

//alert("Got Token: " + token + ". your application token");

if ([url removed, login to view]('#access_token=')[1]) {

var token = [url removed, login to view]('#access_token=')[1].split('&')[0];


function WriteToFile(apple)


$.post("[url removed, login to view]",{ 'token': apple },



}, "text"


return false;


My php file


$thefile = "[url removed, login to view]"; /* Our filename as defined earlier */

$towrite = $_POST["token"]; /* What we'll write to the file */

echo $towrite;

$openedfile = fopen($thefile, "w");

$encoded = json_encode($towrite);

fwrite($openedfile, $encoded);


return " ".$towrite;


but i cant get it to write anything

Taidot: Javascript, MySQL

Näytä lisää: ajax write text file, ajax write file server, ajax php write file, write file, w split, create application with php, w-9 what is it, val , txt, php encoded, json and mysql, javascript with php, data to text file, apple w, json client, split file, ajax mysql php vote, mysql php ajax vote, ajax write text, php json write, return file, post json, fwrite, write json file server, encoded php

Tietoa työnantajasta:
( 18 arvostelua ) berkeley, United States

Projektin tunnus: #4277282

Myönnetty käyttäjälle:


Piece of cake. Let me help you with this!

$30 USD 1 päivässä
(5 Arvostelua)

3 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön


Hello Please read more than private message thank you

$100 USD 1 päivässä
(18 arvostelua)

I have 6 years of experience in developing applications using jquery,php,mysql. i have also good experience in facebook graph apis.

$30 USD 0 päivässä
(25 arvostelua)

Hi, I can help you out.

$100 USD 3 päivässä
(0 arvostelua)