赞
踩
我想要一个curl脚本来获取oneup api的响应.
api链接看起来像
curl https://api.oneup.com/v1/customers -u "api_12_e3ab@api.oneup.com:34a352e421d03a4qXqc91f9b48ed7eb02e5"
我的代码如下:
$url = "https://api.oneup.com/v1/customers -u 'api_133896_9f73@api.oneup.com:70213567295f25ba9fde5127a4348fa22c1b2789'";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13');
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>
我只得到输出1
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。