wordpress data in codeigniter project |
hey everyone ,
i have been given a task which i have to submit it by monday . since i m a newbie i dont have much coding concepts in codeigniter so if guys wanna help me in completing this task just xtend a helping hand task is i m having wordpress blog and codeigniter blog, i have to fetch posts from wordpress blog into codeigniter blog .so if anyone know please help me out here . i have installes oauth2 and wp rest api v2 plugin in my wordpress blog and generated a client id and secret key till here its done after this wat i have to plz suggest me..i have got hthe code from github too
If you're going to do it REST API style, take a look at Phil Sturgeon's REST client library.
https://github.com/philsturgeon/codeigniter-restclient
All you need to do is query the WordPress tables for the blog data. I'm not going to do all of the work for you, because that wouldn't be fair if this is an assignment, but here is a start:
PHP Code: <?php if( ! defined('BASEPATH') ) exit('No direct script access allowed');
(01-13-2017, 10:50 PM)skunkbad Wrote: All you need to do is query the WordPress tables for the blog data. I'm not going to do all of the work for you, because that wouldn't be fair if this is an assignment, but here is a start: I initially thought the same but he didn't mention if he has access to the WP database. That might be why he was doing the REST API, but since he mentioned the API I went that direction. If both sites are on the same server and the assignment allows it you're entirely correct, and it's the easier way to go about it. (01-13-2017, 11:01 PM)Ienlivenapp Wrote:(01-13-2017, 10:50 PM)skunkbad Wrote: All you need to do is query the WordPress tables for the blog data. I'm not going to do all of the work for you, because that wouldn't be fair if this is an assignment, but here is a start: If that's the case the best thing to do, considering that it appears there is access to both servers, would be to set up the WP server to allow remote MySQL connections from the CI server.
(01-13-2017, 11:07 PM)skunkbad Wrote:(01-13-2017, 11:01 PM)Ienlivenapp Wrote:(01-13-2017, 10:50 PM)skunkbad Wrote: All you need to do is query the WordPress tables for the blog data. I'm not going to do all of the work for you, because that wouldn't be fair if this is an assignment, but here is a start: True, but whitelisting remote servers for MySQL access can be a slippery slope for (assumed) new folks and open the server to security vulnerabilities if done incorrectly... but I digress... I don't want to get this too off topic. Hopefully he finds one of the two ways helpful.
(01-13-2017, 10:21 PM)enlivenapp Wrote: If you're going to do it REST API style, take a look at Phil Sturgeon's REST client library. yeah both the blogs are on the same server and i dont know how to make remote mysql access connections that u were talking about. can i do it in this way like i know the database username and password of my wordpress blog so is there anything i can do it with this piece of information
(01-13-2017, 11:12 PM)enlivenapp Wrote:yeah i am having wordpress database username and password , is there anything could be done with this. and i have just join this internship program so they are giving tasks which seems to be much tough to me(01-13-2017, 11:07 PM)skunkbad Wrote:(01-13-2017, 11:01 PM)Ienlivenapp Wrote:(01-13-2017, 10:50 PM)skunkbad Wrote: All you need to do is query the WordPress tables for the blog data. I'm not going to do all of the work for you, because that wouldn't be fair if this is an assignment, but here is a start: (01-14-2017, 12:24 AM)shakeelahmed.cfs Wrote:(01-13-2017, 10:21 PM)enlivenapp Wrote: If you're going to do it REST API style, take a look at Phil Sturgeon's REST client library. Since both blogs are on the same server, you don't need a remote connection. You should just be able to make the connection from CI to the wordpress database. Simple to achieve just following the documentation in the user guide. I've already given you some code that should work instantly, and you'll need to find out the rest on your own. It's 1:15am here, and I've got to get to bed. |
Welcome Guest, Not a member yet? Register Sign In |