且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在PHP中通过cURL抓取CSV

更新时间:2023-02-24 16:09:18

确定可能有几个地方出了错误,很可能$ tmp变量将是你的密钥。

Ok there could be a couple of places which went wrong, most likely the $tmp variable will be your key.

$ url和$ start变量已被正确声明

I am assuming the $url and $start variables have been declared correctly

我建议的第一件事是按照以下方法做一些事情:

First thing I would suggest is to do something along the lines of:

    if( ! $tmp = curl_exec($ch))
        {
           echo curl_error($ch);
        } 

    else
    {

        header("Content-type: application/csv");
        header("Content-Disposition: attachment; filename=$start.csv");
        header("Pragma: no-cache");
        header("Expires: 0");
        echo $tmp;
    }
    curl_close($ch);

可能给你一个关于错误的想法

Might give you an idea about what is going wrong