最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - cUrl alternatives to get POST answer on a webpage - Stack Overflow

matteradmin7PV0评论

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);
Post a comment

comment list (0)

  1. No comments so far