最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin3浏览0评论

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);
发布评论

评论列表(0)

  1. 暂无评论