oedipamaas
Forum Replies Created
-
Forum: Plugins
In reply to: [WP REST API (WP API)] wp-json.php works OK but all other URLS 404I’m getting the same thing…the initial curl for wp-json.php works, but everything else 404s (according to the header). I’m watching my debug.log, but no warnings about the server file not being found. I downloaded the plugin via the wordpress dashboard, then went onto the server and moved the two files as instructed. Then I experienced a brief moment of joy when the initial curl command worked to just wp-json.php. Followed by the familiar letdown of realizing nothing else fetched any json.
My site url has an ip. So it’s https://34.654.xx.xx/sitename/
Will it work with this structure? What do you mean by integrated option?
I’m having the same issue. It should be noted that my site is under development and instead of being on a domain name, it’s currently on an ip.
So it looks like:
https://55.677.xx.xx.x/nameofsite/wp-json.php
Would taking this to a single site instance fix it? I can’t put this on a domain name just yet. Posts returns no json but the initial test url does return everything as expected.
Thanks Angelo. I posted here also as I thought maybe another user might have some insights as well.
Forum: Plugins
In reply to: [CubePoints] "Add Points" doesn't work in WordPress 3.6Oh no. That’s not good news. Is this happening for everyone?
Forum: Plugins
In reply to: [CubePoints] No longer being developed?I’d like to know the answer also. It’s a MUCH needed plugin. If it’s no longer being developed, is there an alternative?
Thanks for the encouragement Eli. I’m almost there, as you said. Now if only I could figure out why json_decode fails in WP. ??
https://wordpress.stackexchange.com/questions/106634/why-is-json-decode-failing
Thanks for your feedback though!
I can’t share the url at all. I work for a large corp and it would be a huge no no. But I can break it down for you a bit better.
What I’m trying to acheive, is to simply talk to this really weird AI system that ALSO holds post ids in its system. When I have a visitor, I send their IP address to this AI system, and the AI system then knows what post id to send back (based on their location). So I know that it’s really weird to have a seperate system also containing post ids when it’s not WP, but there you go. It’s what I’m dealing with.
When I get the JSON back, it looks like this:
{"event_id": "1179", "post_id": "1564", "location_id": "19", "location_postcode": "94301"}
Let’s just call this AI system Skynet. So my application or plugin or addition to a template (not sure which yet) will push a curl get (is there a better way? wp_remote?) to this Skynet-like thing, Skynet responds with the above and I capture that response (again, can I do that with your plugin you think?) and then I json_decode, grab the key–>values and then submit the ids to something like get_post_by_id or whatever is out there. I figured a loop even sort of like:
function myGet_CURL (){ $url = 'https://remoteNONWPserver/event/94303?radius=30'; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0); $result = curl_exec($ch); curl_close($ch); // Prepare the data: $content = trim( wp_remote_retrieve_body( $result ) ); // Convert output to JSON if ( strstr( wp_remote_retrieve_header( $result, 'content-type' ) ,'json' ) ) { $content = json_decode( $content ); $post_id = _json_decode_object_helper('post_id'); //now I need to parse the decoded content. But I need to see what I'm doing in the loop //as I parse and return } return $content; } function myDecodeGetPost(){ $validPosts = array(); $this_post = array(); $id_post = array(); $i = 0; //so once i pull the post id, it gets passed here into a variable that will act as the id $my_query = new WP_Query( $id_post ); if($my_query->have_posts()) { while($i < $my_query->post_count) : $post = $my_query->posts; if(!in_array($post[$i]->ID, $id_post)){ $this_post['id'] = $post[$i]->ID; $this_post['post_content'] = $post[$i]->post_content; $this_post['post_title'] = $post[$i]->post_title; $this_post['guid'] = $post[$i]->guid; $id_post[] = $post[$i]->ID; array_push($validPosts, $this_post); } $post = ''; $i++; endwhile; //figure out how to display the posts you put in the array onto a page now. Put all this into a template? } }
So is the above easier to achieve with your plugin you think? Thanks!
Sure! It would be like this:
curl -XGET https://myremotenonWPserver/event/94303?radius=30
which returns to me something like:
{“0.0”: {“event_id”: “1179”, “post_id”: “1564”}}
So basically I’m trying to submit a radius search, this remote app crunches the numbers and gives me back a list with WP post ids in it. Then I want to load those post ids.
Forum: Plugins
In reply to: [JSON API] create_post for custom post typeI’d like to know if this is possible also! How is it this question isn’t more popular?
Forum: Fixing WordPress
In reply to: XMLRPC via pythonI’d LOVE to hear any answers on this one… Trying to do the same thing.
Is there anyway someone could post the cool snippets that have since expired from pastebin? Or how can I implement a zipcode/radius search like this:
SELECT
name,
((ACOS(SIN( “.$latitude.” * PI() / 180) * SIN(latitude * PI() / 180) + COS(“.$latitude.” * PI() / 180) * COS(latitude * PI() / 180) * COS((“.$longitude.” – longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS distance
FROM
em_locations
WHERE 1
AND location = 1
HAVING distance <= . $radius
ORDER BY distance ASC
LIMIT 10Is this something I could easily do by creating a locations-search.php template?
Hi Marcus!
If it IS an offiial patch, could you somehow tell me how to implement it? It’s not obvious to me yet.
I was getting ready to pass query vars straight into the SQL code and doing my own radius search what not. Still going through the Event Manager tutorial too….
Hey all-
Have been looking for a locations specific search and much to my delight, I found this thread. Unfortunately, the pastebin links are expired. Are there any new pointers to code that works for a locations search?
That’s cool. I’m going to play around with it. Just took another look at the database and I haven’t been using the category field as I wanted to keep my tag structure fairly flat. But it totally frees up that field for a select now. Thanks!
Thanks Marcus. I’ve also been playing around with shortcodes. So I can have an event name or film name as a category? I haven’t done that yet….