[英]get cURL with 2 Parameters php
I'm really confused with cURL.. 我真的对cURL感到困惑。
example : 例如:
i can access with my old cURL code 我可以使用旧的cURL代码访问
cikpoo.com/Member/cardnumber/$card_number
cikpoo.com/会员/卡号/ $卡号
but if i want to access like that 但是如果我想那样访问
cikpoo.com/Member/cardnumber/$card_number/dateSEP/$date
cikpoo.com/会员/卡号/ $ card_number / dateSEP / $ date
how to code that?? 如何编码?
this is my code 这是我的代码
foreach($member_data as $row){
$cardnumber=$row->cardnumber;
$date=$row->date;
}
if($cardnumber==''){
echo "enter your card number";
}else{
$url = $data_b->service_url; //url is cikpoo.com/
$ch = curl_init($url.'Member/cardnumber/'. $cardnumber .'/dateSEP/'. $date ); //problem here
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $http_header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);//json file
curl_close($ch);
This example has some error reporting in it. 此示例中包含一些错误报告。 This is not meant to be an answer.
这并不意味着答案。 Just a working example with error checking.
只是一个带有错误检查的有效示例。
$url = 'https://www.w3schools.com/';
$curl = curl_init($url .'js/ajax_info.txt');
curl_setopt($curl, CURLOPT_HTTPGET, true);
//curl_setopt($curl, CURLOPT_HTTPHEADER, $http_header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
if(!$result){
echo('Error: "' . curl_error($curl) . '" - Code: ' . curl_errno($curl));
}
curl_close($curl);
echo '<br>'.$result;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.