错误请求 400 卷曲问题

发布于 2024-11-15 17:58:46 字数 1670 浏览 3 评论 0原文

当我尝试向 php 中的服务器发送请求时,我似乎遇到了问题。 http api 请求是这样的:

<一href="https://www.quickbase.com/db/basddzvkb?act=API_DoQuery&ticket=6_bsdaaap8y_by5bx6_b_crji7wwewew3b9a sd5zibmf8jh3bhsdsddvhruc9csquzdg9bzw4&apptoken=cgsb5xdwehusdaaagcjs222dz9&fmt=结构化&查询= rel="nofollow">https://www.quickbase.com/db/basddzvkb?act=API_DoQuery&ticket=6_bsdaaap8y_by5bx6_b_crji7wwewew3b9asd5zibm f8jh3bhsdsddvhruc9csquzdg9bzw4&apptoken=cgsb5xdwehusdaaagcjs222dz9&fmt=结构化&query={'22'.ct.'test'}

我在 php 中有以下代码部分,我相信发生了错误:

else
    {
        $ch = curl_init($input);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        //curl_setopt($ch, CURLOPT_POST, true);
        $this->input = $input;

    }

    $r = curl_exec($ch);

    print_r(curl_getinfo($ch));


    if($return_xml) {
        $response = new SimpleXMLElement($r);
    }

这是我从 print_r(curl_getinfo($ch)) 语句中得到的内容:

[内容类型] =>文本/html [http_code] => 400 [标题大小] => 129 [请求大小] =>第251章 [文件时间] => -1 [ssl_verify_result] =>; 20 [重定向计数] => 0 [总时间] => 0.281 [名称查找时间] => 0 [连接时间] => 0.063 [预传输时间] => 0.188 [上传大小] => 0 [大小_下载] => 20 [速度下载] => 71 [上传速度] => 0 [下载内容长度] => 20 [上传内容长度] => 0 [开始传输时间] => 0.281 [重定向时间] => 0 [证书信息] =>数组 ( )

另外你可以看到我注释掉了curlopt_post,因为它在我执行不同的api请求时导致了问题。我不确定解决方案是什么,我已经研究这个问题有一段时间了,希望有人可以帮助我,谢谢:)

It seems like im getting a problem when Im trying to send a request to a server in php. The http api request is something like this:

https://www.quickbase.com/db/basddzvkb?act=API_DoQuery&ticket=6_bsdaaap8y_by5bx6_b_crji7wwewew3b9asd5zibmf8jh3bhsdsddvhruc9csquzdg9bzw4&apptoken=cgsb5xdwehusdaaagcjs222dz9&fmt=structured&query={'22'.ct.'test'}

I have the following part of my code in php where I believe the error is occuring:

else
    {
        $ch = curl_init($input);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        //curl_setopt($ch, CURLOPT_POST, true);
        $this->input = $input;

    }

    $r = curl_exec($ch);

    print_r(curl_getinfo($ch));


    if($return_xml) {
        $response = new SimpleXMLElement($r);
    }

This is what I get from the print_r(curl_getinfo($ch)) statement:

[content_type] => text/html
[http_code] => 400
[header_size] => 129
[request_size] => 251
[filetime] => -1
[ssl_verify_result] => 20
[redirect_count] => 0
[total_time] => 0.281
[namelookup_time] => 0
[connect_time] => 0.063
[pretransfer_time] => 0.188
[size_upload] => 0
[size_download] => 20
[speed_download] => 71
[speed_upload] => 0
[download_content_length] => 20
[upload_content_length] => 0
[starttransfer_time] => 0.281
[redirect_time] => 0
[certinfo] => Array ( )

Also as you can see that I commented out the curlopt_post, its because it was causing problems when I was doing a different api request. Im not sure what the solution can be and I have been looking at this problem for awhile now hopefully someone can help me thanks :)

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

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

发布评论

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

评论(1

以可爱出名 2024-11-22 17:58:46

Datasage 帮助我想出了这个答案,你基本上必须添加 urlencode("{'22'.ct.'test'}");这部分代码将产生正确的输出。

Datasage helped me come up with this answer, you basically have to add urlencode("{'22'.ct.'test'}"); to this part of the code and it will produce the correct output.

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