嗨晚上好晚上正在研究flipkart / snapdeal rest api,其中我们必须卷曲数据。在命令提示符下工作正常,并给我所需的输出。但现在我想在代码中调用它而无法做到这一点。请帮助我。 Api包含令牌和令牌ID。这里我的命令工作正常。
curl -H "Fk-Affiliate-Id:abhishekbh" -H "Fk-Affiliate-Token:2dacb05681b8481eb65201283dac2630" "https://affiliate-api.flipkart.net/affiliate/1.0/feeds/abhishebh/category/7jv.json?expiresAt=1489539219049&sig=ad5ef1af7f41d68d9f8f1c1ae85e20b6"
答案 0 :(得分:0)
这是使用curl发送请求的php代码。
$s = curl_init();
curl_setopt($s,CURLOPT_URL,'https://affiliate-api.flipkart.net/affiliate/1.0/feeds/abhishekbh/category/7jv.json?expiresAt=1489539219049&sig=ad5ef1af7f41d68d9f8f1c1ae85e20b6');
curl_setopt($s,CURLOPT_HTTPHEADER,array('Fk-Affiliate-Id:abhishekbh', 'Fk-Affiliate-Token:2dacb05681b8481eb65291283dac2630'));
curl_setopt($s,CURLOPT_HEADER,true);
$result = curl_exec($s);
echo "<pre>";print_r($result);echo "</pre>";