在 php 中调用其余的 api

Calling the rest api in php

嗨,晚上好,目前正在处理 flipkart/snapdeal 休息 api,我们必须在其中卷曲数据。在命令提示符下它工作正常并给我所需的输出。但现在我想在代码中调用它,但无法做到这一点。请帮我解决这个问题。 Api 包含 token 和 token 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" 

这是使用 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>";