Skip to content

Commit

Permalink
SQL Tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
astechedu committed Feb 26, 2024
1 parent 55b7578 commit a6be0f9
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion sqlphp/developer-notes/php/corephp/APIs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

--------------------------------------------------------
--------------------------------------------------------
Keys: APIs
Keys: APIs, API with Curl,

--------------------------------------------------------
--------------------------------------------------------
Expand All @@ -17,6 +17,9 @@ https://www.interviewbit.com/blog/php-projects/
https://code.tutsplus.com/how-to-build-a-simple-rest-api-in-php--cms-37000t


//Video: API with Curl
https://youtu.be/IPp9tTs9ctY?t=1151

--------------------------------------------------------
--------------------------------------------------------

Expand Down Expand Up @@ -105,6 +108,47 @@ echo $json_response;
---------------------------------------------------------------------------------------


---> API with Curl <---

//Video: https://youtu.be/IPp9tTs9ctY?t=1344

<?php
$url="https://programingwithvishal.com/api/";
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$result=curl_exec($ch);
curl_close($ch);
$result=json_decode($result); //json_decode($result,ture); in array form
//echo '<pre>';
//print_r($result);

if(isset($result['status'])){
if($result['status']==true){
if(isset($result['result']))
if($result['result']==true){


}else{
echo $result['data];
}
}else{

}
}else{
echo "API not working";
}



?>




-----x------





Expand Down

0 comments on commit a6be0f9

Please sign in to comment.