1

Is there a way to send POST data using HTTP headers without a form from PHP?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Ethan H
  • 717
  • 1
  • 13
  • 27
  • 1
    PHP runs on the server side. Do you mean "from javascript"? – Joe Flynn May 01 '12 at 01:38
  • is something like this what ur looking for? [Post to a page using PHP header function][1] [1]: http://stackoverflow.com/questions/653090/how-do-you-post-to-a-page-using-the-php-header-function – Hazy McGee May 01 '12 at 01:38
  • I know php is server side, but you can set headers. EX: header("location: http://google.com") – Ethan H May 01 '12 at 01:39
  • Like cURL you mean? http://php.net/manual/en/book.curl.php – PorridgeBear May 01 '12 at 01:41
  • Sort of, except my host won't allow adding extensions to the PHP installation; is there any way to send a value without using a form, $_GET, $_SESSION, $_COOKIES (I don't want it to be saved or shown anywhere) – Ethan H May 01 '12 at 01:45

2 Answers2

3

Sure, you can create a valid http request with your specified POST parameters easily using a library like cURL.

See this for a curl example

If you are limited to plain PHP you can create your own (valid) http-request, see example

Garuda
  • 374
  • 1
  • 5
0

I don't think you can. You might want to use sessions, cookies, hidden forms or $_GET

3ethanh
  • 34
  • 2