Тёмный
No video :(

How To Create A Simple REST API in PHP 

Vicode Media
Подписаться 7 тыс.
Просмотров 218 тыс.
50% 1

How To Create A Simple REST API in PHP. JSON.
Buy Me a Coffee ;)
paypal.me/Vict...
Hosting I Use:
m.do.co/c/e924... (Get $100 in credit over 60 days)

Опубликовано:

 

21 окт 2018

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 105   
@ilyeschouia6645
@ilyeschouia6645 5 лет назад
sorry, but that's called fetching data from a DB and returning it as json... the key component of a REST API is the use of RESTful urls and i can't spot any in this video... that's without mentioning how "spaghetti code" this example in your video was
@MrHics
@MrHics 4 года назад
^^This. Makes it tough that on RU-vid, almost every "REST tutorial" is not RESTful at all :-(
@thedarkthrone4699
@thedarkthrone4699 3 года назад
LOL...Do you know anything about programming at all? The URL in the code "index.php" if am not mistaken, returns the JSON data fetch. You can now modify how users are to access that data using GET parameters and conditions. The only reason for any API is to return data...and that's exactly what this is about.
@ilyeschouia6645
@ilyeschouia6645 3 года назад
@thronesoft tech So REST is just about returning JSON huh? Wow 😳
@happinin
@happinin 3 года назад
@@thedarkthrone4699 you are severely mistaken. do you know anything about programming? REST API's have endpoints (routes) which are redirected to controllers that then access the database. They typically have an MVC architecture. This is just a regular php file returning data.
@thedarkthrone4699
@thedarkthrone4699 3 года назад
@@happinin ...thats exactly what it has to be; API's return data. The "endpoint"? The guy made a tutorial on the basics! need something with "endpoints", It's not the basics.
@DeanPickersgill
@DeanPickersgill 3 года назад
In which universe is this an API? It's an overcomplicated way of echoing json through PHP. Nonsense.
@thallesrangel1241
@thallesrangel1241 4 года назад
Isto não é uma API REST, rest utiliza os protocolos HTTP (PUT, POST, GET, DELETE)
@pandurangpnaik5858
@pandurangpnaik5858 4 года назад
Can I use this for Android application to call data using volley or retrofit library?
@fullstackdeveloper4424
@fullstackdeveloper4424 2 года назад
This video helped me alot to see how the api works in php
@ellixt4187
@ellixt4187 4 года назад
Bruh, how is this a "rest" API. This is like returning data from a database in json format lol.
@llewellynleesan77
@llewellynleesan77 3 года назад
exactly, theres no point if youre making an api most people are gonna call an api
@FellTheSky
@FellTheSky 3 года назад
This is not rest
@robeeeeen
@robeeeeen 5 лет назад
We can use Postman too! Excellent tutorial.
@ibtesamatiq1399
@ibtesamatiq1399 4 года назад
@@average_guy-t9q For testing Api's.
@AbdulBasit-ne4od
@AbdulBasit-ne4od 2 года назад
Do you think it is Rest API ? 😁
@hardigohel6132
@hardigohel6132 4 года назад
how can i integrate this code with my website to make api?
@TH3BADRO
@TH3BADRO Год назад
Hi there, Thanks for the tutorial! But what would you do if you had other methods like to update to store records ? Would you declare the database connection object in each ? In my opinion, it would be better to have that object as a property of the class API, and pass it to the constructor when creating the object (dependency injection).
@subhodeepbhattacharjee656
@subhodeepbhattacharjee656 4 года назад
Hi, May i know why we use API, because every work if we want , do custom. So why we create API ? May you please explane...
@Mycotta01
@Mycotta01 4 года назад
we create api for easy work on the future, Like when we creating car rental web php x mysql with api so when we create car rental app on android, we can call that api, so we don't have to create data manually #cmiiw
@camera-support-rentals
@camera-support-rentals 5 лет назад
How do you submit the jason file to the server? I need to learn this so I can submit my cart totals to a credit card processor. Thanks
@VicodeMedia
@VicodeMedia 5 лет назад
Hi, Jon! I made two videos for you here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-6fuhZa6OM2k.html I hope this will help you to build your project. Let me know if you have any questions.
@muhammadfaateh6463
@muhammadfaateh6463 4 года назад
@@VicodeMedia thanks
@nandhakumarrm3478
@nandhakumarrm3478 3 года назад
@@VicodeMedia f
@straher
@straher Год назад
Thanks! Well done
@atwa3794
@atwa3794 3 года назад
Whats about sub urls? like localhost/users/5
@VicodeMedia
@VicodeMedia 3 года назад
Check this out: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Oe3Td3AeGoA.html
@charlesluck8921
@charlesluck8921 2 года назад
Can someone explain why everyone prefers to use XAMPP on Windows systems, and not WAMP?
@VicodeMedia
@VicodeMedia 2 года назад
XAMPP is more powerful and resource taking than WAMP. WAMP provides support for MySQL and PHP. XAMPP also has SSL feature while WAMP doesnt.
@prasadkadam5210
@prasadkadam5210 3 года назад
Thank you
@VicodeMedia
@VicodeMedia 3 года назад
You're welcome!
@EchoENKO
@EchoENKO 5 месяцев назад
Thank you!
@nestaho8399
@nestaho8399 Год назад
I receive the following error Parse error: syntax error, unexpected '__DIR__' (T_DIR) in C:\xampp\htdocs\index.php on line 2 why??
@VicodeMedia
@VicodeMedia Год назад
I think you didn't include the config.php file properly. Make sure the directory is correct.
@nipunabandarakarunarathne3544
@nipunabandarakarunarathne3544 4 года назад
superb it works thanks
@j.almadhaji
@j.almadhaji 4 года назад
How can I return array that has many objects .. not object inside an object I mean by object => associative array
@lazylofi4491
@lazylofi4491 5 лет назад
thank you sir
4 года назад
Thank you for tutorial
@diooktarovelino3546
@diooktarovelino3546 3 года назад
thankyou, helped me :)
@ifrakouser6316
@ifrakouser6316 2 года назад
I tried accordingly....but it's throwing some error... The error is like...CLass 'Connect' not found.... Can anybody plz help me out with this
@courvoisier137
@courvoisier137 2 года назад
sry, Victor, I cant buy you a coffee cause I live in Belarus. Its too hard to use paypal as a payment system :) but the lesson is very excellent... I can understand your eng speech
@VicodeMedia
@VicodeMedia 2 года назад
Hi, Roman! I'm glad you found value in the video. That's what matters ;)
@tushardabhi9118
@tushardabhi9118 4 года назад
Thank you so much perfect !!
@inteligenciamilgrau
@inteligenciamilgrau 4 года назад
Thank you so much!! Perfect!!!
@vaishalipatil4939
@vaishalipatil4939 Год назад
Fetching of data in json format
@amolbodhare9761
@amolbodhare9761 4 года назад
Nice video,,but I wanted the advanced response with status code and data array also other crud opertaions
@mustafaesamm
@mustafaesamm 3 года назад
thank youuuuuuuuuuuuuuuuuu
@SimPwear84
@SimPwear84 5 лет назад
Thank you so much for this video- simple, straight to the point and very useful. You deserve x10 thumbs up! I subbed,will be following your channel.
@AbdulBasit-ne4od
@AbdulBasit-ne4od 2 года назад
It is not REST API. He is making you fool.
@developeraccount438
@developeraccount438 4 года назад
how we add error like if this wrong error this etc
@sazyt
@sazyt 5 лет назад
But it's showing error in reactjs. 'Access-Allow-Origin' Pls help me
@chanukagayantha
@chanukagayantha Год назад
@offilawnoone9020
@offilawnoone9020 2 года назад
What was it?
@muhammadabubakar8576
@muhammadabubakar8576 5 лет назад
Well explained !! Sir how to create api for IOS application ?
@mibrahim4245
@mibrahim4245 Год назад
same .. on your iOS front-end (react native for example), you can manage to send requests to this PHP API, and then you handle the JSON response ...
@morisfalearn3965
@morisfalearn3965 4 года назад
so where is the api token? this not have a token
@user-cy7gi8no2m
@user-cy7gi8no2m 4 месяца назад
How to integrate 3rd party API in php
@forfun4969
@forfun4969 4 года назад
If we want to send json data to another third party to receive, how we should create?
@VicodeMedia
@VicodeMedia 4 года назад
Check this out. In these videos I am showing how to read and insert data: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-6fuhZa6OM2k.html
@imadeekosatriawiguna6252
@imadeekosatriawiguna6252 2 года назад
So, this is the rest API? I thought it was hard, like something different. How about if we send data like picture or file etc. How does it work in rest API?
@hamzademnati2062
@hamzademnati2062 2 года назад
you just send the url of image not the image by it self
@mibrahim4245
@mibrahim4245 Год назад
same !
@cseale61
@cseale61 3 года назад
Dude, do you even know what a RESTful API is? Hint - this ain't it. This is a PHP page that does a MySQL query and returns the results to itself. Not even close. I also have some issues with your coding. Actually, I have a lot of issues with what you are doing.
@mahyarbehzadi738
@mahyarbehzadi738 3 года назад
Thanks for this tutorial 🌹, but please reduce your microphone's noise
@f123006
@f123006 3 года назад
Thank you! It helps!
@halilullahaj
@halilullahaj 2 года назад
Hi there, I just wanted to ask how to decode json, so that I can get only one object from the array/database? In other words, how can I output only 'name'? Thank you in advance! I tried this, but it didn't work: $arr = json_decode(json_encode($response), true); echo $arr->name;
@anarchistz4133
@anarchistz4133 2 года назад
Why would you wanna do that using PHP? The whole point of REST APIs is provide a communication channel between frontend and backend. Once the data is retrieved from DB and is presented in JSON format, you can simply handle it on the client-side using JS
@mibrahim4245
@mibrahim4245 Год назад
you should not do that in the API, take whatever you want in the front end .. however, in this particular example, if you only wanted to output the name .. you could do: return ( json_encode ( $users['name'] );
@happinin
@happinin 3 года назад
this is not a rest api. this is a php file that echos data. author should learn what a REST API is before trying to teach others how to build one.
@kevinbrosnahan2416
@kevinbrosnahan2416 4 года назад
Very useful. Thanks!
@julsfadriquelan3230
@julsfadriquelan3230 2 года назад
why do you make a file directly inside of the htdocs folder? I mean you can make a folder called 'Restful API tutorial' and then put the file inside of that folder. Please explain.
@xosmsphoneadmin6753
@xosmsphoneadmin6753 3 года назад
what console are you using?
@VicodeMedia
@VicodeMedia 3 года назад
Atom
@user-cy7gi8no2m
@user-cy7gi8no2m 4 месяца назад
Hi sir
@lucascunha3978
@lucascunha3978 4 года назад
How to use the API to receive data?
@VicodeMedia
@VicodeMedia 4 года назад
You should use it in a front end app.
@seventcentlothy105
@seventcentlothy105 5 лет назад
hello teacher can you send me that default code that you paste on And all of that thank you for help it great job you done
@anshuverma1182
@anshuverma1182 4 года назад
session is not working in rest api
@VicodeMedia
@VicodeMedia 4 года назад
Can you give us more details? Are you talking about PHP session?
@deepjyotibaishya7576
@deepjyotibaishya7576 5 лет назад
sir, how to use rand(); function also 'where' and number of data view like this opentdb.com/api.php?amount=1&category=9
@devarshbhatt5612
@devarshbhatt5612 4 года назад
Can someone explain me what REST API really is? please in simplest English
@VicodeMedia
@VicodeMedia 4 года назад
A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. See more here: en.wikipedia.org/wiki/Representational_state_transfer
@EnavSounds
@EnavSounds 3 года назад
is an api that uses http methods to decribe crud operations and usest urls to describe ghe object/resource to modify/read. the api works with json data most of hhe times. for example: GET: /phonebook/contac/123. it returns the contact id 123 from the phonebook
@beticohernandez9536
@beticohernandez9536 4 года назад
Seria bueno el inser .update y delete.
@VicodeMedia
@VicodeMedia 4 года назад
Here is read and insert. Update and delete is going to be your homework :-) ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-6fuhZa6OM2k.html
@iamiftekharalam
@iamiftekharalam 2 года назад
how is this an api?
@VicodeMedia
@VicodeMedia 2 года назад
A simple concept
@BigDaddy-zp6hz
@BigDaddy-zp6hz 3 года назад
Все ясно, русское радио
@awenn2015
@awenn2015 3 года назад
Эм, русское название и английское видео?...
@seventcentlothy105
@seventcentlothy105 5 лет назад
or paste your link here to take some code when you teach us
@VicodeMedia
@VicodeMedia 5 лет назад
Hi, Sevent! Sorry for not leaving the source code for this tutorial. Please watch this tutorial about how to read and insert data: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-6fuhZa6OM2k.html there I have the source code and it is more complex.
@RanjitSingh-bm7rn
@RanjitSingh-bm7rn 3 года назад
please dont waste your time this is totally fool man .......nonsense
Далее
Get 10 Mega Boxes OR 60 Starr Drops!!
01:39
Просмотров 11 млн
女孩妒忌小丑女? #小丑#shorts
00:34
Просмотров 9 млн
What is a REST API?
9:12
Просмотров 1,5 млн
Create A Python API in 12 Minutes
12:05
Просмотров 610 тыс.
Always Check for the Hidden API when Web Scraping
11:50
Learn JSON in 10 Minutes
12:00
Просмотров 3,1 млн
How to use PHP cURL to Handle JSON API Requests
10:57
Просмотров 118 тыс.
PHP REST API From Scratch [1] - Database & Read
32:18
Просмотров 510 тыс.
REST API concepts and examples
8:53
Просмотров 6 млн