I'm really confused with cURL..
example :
i can access with my old cURL code
cikpoo.com/Member/cardnumber/$card_number
but if i want to access like that
cikpoo.com/Member/cardnumber/$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;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.