0

How do i call an api in php to save in mysql using cron jobs...??

i have an api and wanted to display it on my site, but i dont have experience about php and mysql. i know everything about html and css only. Now i want to save an api data in mysql using cron jobs in php script and after that i will show it on my site, help me plz

11/28/2016 4:15:46 PM

Ajay Bamalwa

5 Answers

New Answer

+1

If you want to acces API via web, and get output of it. You can use cURL (Client URL) PHP. Set the require parameter(s) on API, and cURL will get the output from API. And then you only need insert its output to database.

+1

You can learn cURL from this code on github, https://github.com/php-curl-class/php-curl-class Or, you can learn step by step from this website. http://www.techflirt.com/php/php-curl/index.html

+1

First, you have to make a function for connecting to your db, mysql_connect('localhost', $username_db, $pass_db) Then you have to get output of cURL. Then you create sql query on your php, $query = 'INSERT bla.. bla... bla...' Finally, execute thats query using sql query function, mysql_query($query) Done...

0

yes i want to access api url via web, but i dont know how to add parameters

0

oky, did it. now i want to save this in mysql using cronjob. i have created cron job for my file. now how to save it in mysql...?? thanks for your help