无营养,只是为了记录
c.getinfo(c.HTTP_CODE)
c.getinfo(c.TOTAL_TIME)
c.getinfo(c.SPEED_DOWNLOAD)
c.getinfo(c.SIZE_DOWNLOAD)
c.getinfo(c.CONTENT_TYPE)
c.getinfo(c.NAMELOOUP_TIME)
c.getinfo(c.REDIRECT_TIME)
c.getinfo(c.REDIRECT_COUNT)
c.getinfo(c.INFO_FILETIME)
c.getinfo(c.PRIMARY_PORT)
c.getinfo(c.LOCAL_IP)
c.getinfo(c.LOCAL_PORT)
c.getinfo(c.EFFECTIVE_URL)
超时时,curl_errno()会返回28
- 超时
- curl_setopt($ch, CURLOPT_TIMEOUT, 40);
- curl_setopt($ch, CURLOPT_TIMEOUT_MS, 40);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 40);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 40);
- 自动跳转
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
- post
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
- header
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
- curl_setopt($ch, CURLOPT_REFERER, $ref_url);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // 指定header
- cookie
- curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
- curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
- 有时也许会用到https
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- 有时也许会用到代理
- curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
- curl_setopt($ch, CURLOPT_PROXY, $proxy);
/Library/Python/2.7/site-packages/xapian