Read Json request inside PHPHow can I prevent SQL injection in PHP?How do I format a Microsoft JSON date?Can comments be used in JSON?How can I pretty-print JSON in a shell script?What is the correct JSON content type?JavaScript closure inside loops – simple practical exampleWhy does Google prepend while(1); to their JSON responses?Reference — What does this symbol mean in PHP?How can I pretty-print JSON using JavaScript?Parse JSON in JavaScript?
Do people with slow metabolism tend to gain weight (fat) if they stop exercising?
I have a problematic assistant manager, but I can't fire him
Possible runaway argument using circuitikz
How can one's career as a reviewer be ended?
A word that means "blending into a community too much"
Why Does Mama Coco Look Old After Going to the Other World?
If I leave the US through an airport, do I have to return through the same airport?
What does the pair of vertical lines in empirical entropy formula mean?
Teaching a class likely meant to inflate the GPA of student athletes
Why AM-GM inequality showing different results?
If a Variant Human is Reincarnated, would they lose the feat and skill proficiency they started with?
Why is long-term living in Almost-Earth causing severe health problems?
Please figure out this Pan digital Prince
C++ logging library
How can I make 12 tone and atonal melodies sound interesting?
The usage of kelvin in formulas
How long is it safe to leave marker on a Chessex battle map?
Printing Pascal’s triangle for n number of rows in Python
bash vs. zsh: What are the practical differences?
Amplitude of a crest and trough in a sound wave?
Who voices the small round football sized demon In Good Omens
What aircraft was used as Air Force One for the flight between Southampton and Shannon?
Write a function that checks if a string starts with or contains something
What is the color of artificial intelligence?
Read Json request inside PHP
How can I prevent SQL injection in PHP?How do I format a Microsoft JSON date?Can comments be used in JSON?How can I pretty-print JSON in a shell script?What is the correct JSON content type?JavaScript closure inside loops – simple practical exampleWhy does Google prepend while(1); to their JSON responses?Reference — What does this symbol mean in PHP?How can I pretty-print JSON using JavaScript?Parse JSON in JavaScript?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am using the following request to close php session.
And the question is how to read the json request inside logout.php php file where I will have something like this to happen logout.php?logout=true
.
Any help is much appreciated.
var data =
var1:"logout=true",
;
var querystring = require("querystring");
var qs = querystring.stringify(data);
var qslength = qs.length;
var options =
hostname: "www.url.com",
port: 80,
path: "logout.php",
method: 'POST',
headers:
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': qslength
;
var buffer = "";
var req = http.request(options, function(res)
res.on('data', function (chunk)
buffer+=chunk;
);
res.on('end', function()
console.log(buffer);
);
);
req.write(qs);
req.end();
javascript php node.js json
add a comment |
I am using the following request to close php session.
And the question is how to read the json request inside logout.php php file where I will have something like this to happen logout.php?logout=true
.
Any help is much appreciated.
var data =
var1:"logout=true",
;
var querystring = require("querystring");
var qs = querystring.stringify(data);
var qslength = qs.length;
var options =
hostname: "www.url.com",
port: 80,
path: "logout.php",
method: 'POST',
headers:
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': qslength
;
var buffer = "";
var req = http.request(options, function(res)
res.on('data', function (chunk)
buffer+=chunk;
);
res.on('end', function()
console.log(buffer);
);
);
req.write(qs);
req.end();
javascript php node.js json
2
This will generate a very very ordinary POST request for your php script.
– mario
Mar 24 at 20:42
1
May help if they actual sent the data. Never added thedata
var tooptions
var..... Just saying.
– ArtisticPhoenix
Mar 24 at 20:48
1
@ArtisticPhoenix - (0) actual --> actually. (1)req.write(sq);
outputs the data. Am I mistaken?
– enhzflep
Mar 24 at 22:40
$_POST['var1']
should contain the string"logout=true"
. Is that what you're after?
– Phil
Mar 25 at 3:46
1
@ArtisticPhoenix nodata
option exists ~ nodejs.org/api/http.html#http_http_request_options_callback
– Phil
Mar 25 at 3:48
add a comment |
I am using the following request to close php session.
And the question is how to read the json request inside logout.php php file where I will have something like this to happen logout.php?logout=true
.
Any help is much appreciated.
var data =
var1:"logout=true",
;
var querystring = require("querystring");
var qs = querystring.stringify(data);
var qslength = qs.length;
var options =
hostname: "www.url.com",
port: 80,
path: "logout.php",
method: 'POST',
headers:
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': qslength
;
var buffer = "";
var req = http.request(options, function(res)
res.on('data', function (chunk)
buffer+=chunk;
);
res.on('end', function()
console.log(buffer);
);
);
req.write(qs);
req.end();
javascript php node.js json
I am using the following request to close php session.
And the question is how to read the json request inside logout.php php file where I will have something like this to happen logout.php?logout=true
.
Any help is much appreciated.
var data =
var1:"logout=true",
;
var querystring = require("querystring");
var qs = querystring.stringify(data);
var qslength = qs.length;
var options =
hostname: "www.url.com",
port: 80,
path: "logout.php",
method: 'POST',
headers:
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': qslength
;
var buffer = "";
var req = http.request(options, function(res)
res.on('data', function (chunk)
buffer+=chunk;
);
res.on('end', function()
console.log(buffer);
);
);
req.write(qs);
req.end();
javascript php node.js json
javascript php node.js json
edited Mar 25 at 3:33
Craig van Tonder
3,744135086
3,744135086
asked Mar 24 at 20:40
John SinigerJohn Siniger
5371926
5371926
2
This will generate a very very ordinary POST request for your php script.
– mario
Mar 24 at 20:42
1
May help if they actual sent the data. Never added thedata
var tooptions
var..... Just saying.
– ArtisticPhoenix
Mar 24 at 20:48
1
@ArtisticPhoenix - (0) actual --> actually. (1)req.write(sq);
outputs the data. Am I mistaken?
– enhzflep
Mar 24 at 22:40
$_POST['var1']
should contain the string"logout=true"
. Is that what you're after?
– Phil
Mar 25 at 3:46
1
@ArtisticPhoenix nodata
option exists ~ nodejs.org/api/http.html#http_http_request_options_callback
– Phil
Mar 25 at 3:48
add a comment |
2
This will generate a very very ordinary POST request for your php script.
– mario
Mar 24 at 20:42
1
May help if they actual sent the data. Never added thedata
var tooptions
var..... Just saying.
– ArtisticPhoenix
Mar 24 at 20:48
1
@ArtisticPhoenix - (0) actual --> actually. (1)req.write(sq);
outputs the data. Am I mistaken?
– enhzflep
Mar 24 at 22:40
$_POST['var1']
should contain the string"logout=true"
. Is that what you're after?
– Phil
Mar 25 at 3:46
1
@ArtisticPhoenix nodata
option exists ~ nodejs.org/api/http.html#http_http_request_options_callback
– Phil
Mar 25 at 3:48
2
2
This will generate a very very ordinary POST request for your php script.
– mario
Mar 24 at 20:42
This will generate a very very ordinary POST request for your php script.
– mario
Mar 24 at 20:42
1
1
May help if they actual sent the data. Never added the
data
var to options
var..... Just saying.– ArtisticPhoenix
Mar 24 at 20:48
May help if they actual sent the data. Never added the
data
var to options
var..... Just saying.– ArtisticPhoenix
Mar 24 at 20:48
1
1
@ArtisticPhoenix - (0) actual --> actually. (1)
req.write(sq);
outputs the data. Am I mistaken?– enhzflep
Mar 24 at 22:40
@ArtisticPhoenix - (0) actual --> actually. (1)
req.write(sq);
outputs the data. Am I mistaken?– enhzflep
Mar 24 at 22:40
$_POST['var1']
should contain the string "logout=true"
. Is that what you're after?– Phil
Mar 25 at 3:46
$_POST['var1']
should contain the string "logout=true"
. Is that what you're after?– Phil
Mar 25 at 3:46
1
1
@ArtisticPhoenix no
data
option exists ~ nodejs.org/api/http.html#http_http_request_options_callback– Phil
Mar 25 at 3:48
@ArtisticPhoenix no
data
option exists ~ nodejs.org/api/http.html#http_http_request_options_callback– Phil
Mar 25 at 3:48
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55328353%2fread-json-request-inside-php%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55328353%2fread-json-request-inside-php%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
This will generate a very very ordinary POST request for your php script.
– mario
Mar 24 at 20:42
1
May help if they actual sent the data. Never added the
data
var tooptions
var..... Just saying.– ArtisticPhoenix
Mar 24 at 20:48
1
@ArtisticPhoenix - (0) actual --> actually. (1)
req.write(sq);
outputs the data. Am I mistaken?– enhzflep
Mar 24 at 22:40
$_POST['var1']
should contain the string"logout=true"
. Is that what you're after?– Phil
Mar 25 at 3:46
1
@ArtisticPhoenix no
data
option exists ~ nodejs.org/api/http.html#http_http_request_options_callback– Phil
Mar 25 at 3:48