Jump to content

Processwire Does not Recieve Post Params


clsource
 Share

Recommended Posts

Hello, 

I'm doing an API and I need that receives params via POST, 

I'm using Postman extension (https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm)

for testing purposes and I am not recieving the vars, 

but I do a curl

curl --data "var1=123&var2=asdf" http://mywebsite/function

I got them right.

On the access logs I got this

192.185.39.26 - - [08/May/2014:18:25:03 -0500] "POST  http://mywebsite/function%C2'> 200 - "-" "-"

Does Processwire have a security enabled for calls via post without headers?

Thanks :)

Link to comment
Share on other sites

Thanks Soma,

But I made a raw php file 

that echos $_POST

and placed outsite processwire dir.

<?php

foreach($_POST as $key => $value) {

   echo "$key : $value <br>";
} 

I successfully receive the post vars.

oddly if I try the same script inside Processwire templates directory

all $_POST vars are empty.

I used  the FileLogger class for output a step by step execution of the script and neither that

file is generated

// Logger Class
$log = new FileLog($config->paths->logs . 'EXEC_' . date('YmdHis') . '.log');

$log->save('Script was started');

I think the solution is to have a raw php file in the same folder as index.php

and bootstrap processwire for database access.

Link to comment
Share on other sites

It doesn't matter if $input->post or $_POST. I'm not sure I understand what you're trying to do, but inside php templates POST and GET vars works fine. PW uses it, I use it, everybody uses it.

As I said, you need to post to a PW url with a trailing slash, or it will get redirected  and lose the POST.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...