PHP用curl采集某个url出现400异常求解

WBOY
Release: 2016-06-13 10:33:36
Original
1385 people have browsed it

PHP用curl采集某个url出现400错误求解

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$ch = curl_init();             curl_setopt($ch, CURLOPT_URL,$url);             //curl_setopt($ch, CURLOPT_HEADER, false);             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);             //curl_setopt($ch, CURLOPT_TIMEOUT, 30);            //curl_setopt($ch, CURLOPT_POST, 0);             $data = curl_exec($ch);             curl_close($ch);             return $data;
Copy after login

其中URL地址是当当网的API测试账号提供给返回加密的url地址数据 地址如下http://api.dangdang.com/v2/searchOrders.php?gShopID=170&lastModifyTime_end=2012-07-05 09:33:46&lastModifyTime_start=2012-06-28 09:33:46&os=101&p=1&pageSize=10&validateString=c4c1401682b12afdc1e2d67124936edc 求高人详解 直接复制拷贝到浏览器是无任何问题的

------解决方案--------------------
先做一次 $url = str_replace(' ', '+', $url); 即可
------解决方案--------------------
这样也行。。~~
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template