PHP CURL 发布返回结果,但我需要空结果

发布于 2024-12-04 01:40:40 字数 1157 浏览 1 评论 0原文

我正在做curl post,但问题是我需要返回空结果,以便我可以为我的ajax请求结果回显另一个值:

下面是代码:

$ch = curl_init("http://www.rankreport.com.au/ajax/add_new_lead");
                    curl_setopt($ch, CURLOPT_POST, 1);
                    curl_setopt($ch, CURLOPT_POSTFIELDS, "lead_company_id=1&lead_business=1234&lead_first_name=asdf&lead_website=12314.com&lead_phone=1234&[email protected]&lead_package=seo");
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                    curl_exec($ch);
                    curl_close($ch);

                    echo 'error 3';

当我这样做时,我得到以下结果:

{"lead_date":1315637343,"lead_company_id":"1","lead_business":"1234","lead_first_name":"asdf","lead_last_name":"","lead_website":"12314.com","lead_phone":"1234","lead_email":"[email protected]","lead_package":"seo"} 3

如何设置卷曲选项,以便它不返回任何卷曲结果?

I'm doing curl post but the problem is that I need to return empty results so I can echo out another value for my ajax request results:

below is the code:

$ch = curl_init("http://www.rankreport.com.au/ajax/add_new_lead");
                    curl_setopt($ch, CURLOPT_POST, 1);
                    curl_setopt($ch, CURLOPT_POSTFIELDS, "lead_company_id=1&lead_business=1234&lead_first_name=asdf&lead_website=12314.com&lead_phone=1234&[email protected]&lead_package=seo");
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                    curl_exec($ch);
                    curl_close($ch);

                    echo 'error 3';

When I do this, I'm getting below results:

{"lead_date":1315637343,"lead_company_id":"1","lead_business":"1234","lead_first_name":"asdf","lead_last_name":"","lead_website":"12314.com","lead_phone":"1234","lead_email":"[email protected]","lead_package":"seo"} 3

How do set curl options so that it doesn't return any curl results?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

汐鸠 2024-12-11 01:40:40

设置CURLOPT_RETURNTRANSFER

curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);

Set CURLOPT_RETURNTRANSFER:

curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
宁愿没拥抱 2024-12-11 01:40:40

使用CURLOPT_RETURNTRANSFER = true将返回的内容作为返回值($ch)而不是输出。

Use CURLOPT_RETURNTRANSFER = true to have the returned content as a return value ($ch) instead of output.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文