如何在没有卷曲的情况下发帖请求? [英] How to make a post request without curl?

查看:123
本文介绍了如何在没有卷曲的情况下发帖请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑到我不想使用curl,这是发布帖子请求的有效替代方法吗?也许 Zend_http_client

Considering I don't want to use curl, which is a valid alternative to make a post request? Maybe Zend_http_client?

我只需要基本的东西(我需要一个只有一个帖子参数的网址)

I just need the basic stuff (I need to request an url with only one post param)

推荐答案

如果您已经在使用Zend Framework,那么您应该尝试 Zend_Http_Client

If you are using the Zend Framework already you should try the Zend_Http_Client you mentioned:

$client = new Zend_Http_Client($host, array(
            'maxredirects' => 3,
            'timeout'      => 30));
$client->setMethod(Zend_Http_Client::POST);
// You might need to set some headers here
$client->setParameterPost('key', 'value');
$response = $client->request();

这篇关于如何在没有卷曲的情况下发帖请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆