admin管理员组

文章数量:1026271

I would like to get the resulting web page of a specific form submit. This form is using POST so my current goal is to be able to send POST data to an url, and to get the HTML content of the result in a variable.

My problem is that i cannot use cUrl (not enabled), that's why i ask for your knowledge to know if an other solution is possible.

Thanks in advance

I would like to get the resulting web page of a specific form submit. This form is using POST so my current goal is to be able to send POST data to an url, and to get the HTML content of the result in a variable.

My problem is that i cannot use cUrl (not enabled), that's why i ask for your knowledge to know if an other solution is possible.

Thanks in advance

Share Improve this question asked Jul 13, 2012 at 10:29 Al_thAl_th 1,1951 gold badge12 silver badges24 bronze badges 1
  • I'll try to find my way with it, even if it will be totally new for me ^^ Thanks – Al_th Commented Jul 13, 2012 at 10:39
Add a ment  | 

2 Answers 2

Reset to default 4

See this, using fsockopen: http://www.jonasjohn.de/snippets/php/post-request.htm

Fsockopen is in php standard library, so all php fron version 4 has it :)

try file_get_contents() and stream

$opts = array(  'http'=>array('method'=>"POST", 'content' => http_build_query(array('status' => $message)),));

$context = stream_context_create($opts);

// Open the file using the HTTP headers set above
$file = file_get_contents('http://www.example./', false, $context);

I would like to get the resulting web page of a specific form submit. This form is using POST so my current goal is to be able to send POST data to an url, and to get the HTML content of the result in a variable.

My problem is that i cannot use cUrl (not enabled), that's why i ask for your knowledge to know if an other solution is possible.

Thanks in advance

I would like to get the resulting web page of a specific form submit. This form is using POST so my current goal is to be able to send POST data to an url, and to get the HTML content of the result in a variable.

My problem is that i cannot use cUrl (not enabled), that's why i ask for your knowledge to know if an other solution is possible.

Thanks in advance

Share Improve this question asked Jul 13, 2012 at 10:29 Al_thAl_th 1,1951 gold badge12 silver badges24 bronze badges 1
  • I'll try to find my way with it, even if it will be totally new for me ^^ Thanks – Al_th Commented Jul 13, 2012 at 10:39
Add a ment  | 

2 Answers 2

Reset to default 4

See this, using fsockopen: http://www.jonasjohn.de/snippets/php/post-request.htm

Fsockopen is in php standard library, so all php fron version 4 has it :)

try file_get_contents() and stream

$opts = array(  'http'=>array('method'=>"POST", 'content' => http_build_query(array('status' => $message)),));

$context = stream_context_create($opts);

// Open the file using the HTTP headers set above
$file = file_get_contents('http://www.example./', false, $context);

本文标签: phpcUrl alternatives to get POST answer on a webpageStack Overflow