AnsBix8
Path:
/
/
home
/
omb
/
public_html
/
old
CMD:
UPLOAD:
Editing:
export_posts.php
<?php include 'wp-load.php'; $posts = get_posts(array( 'post_type' => 'post', 'post_status' => 'publish', 'order' => 'ASC', 'posts_per_page' => 10, 'meta_query' => array( array( 'key' => 'evg_exported', 'compare' => 'NOT EXISTS' ) ) )); foreach ($posts as $p) { $meta = get_post_meta($p->ID); $cats = get_the_category($p->ID); $p->meta = array(); $p->genres = array(); if(!empty($meta)){ foreach($meta as $i=>$m){ if($i == 'thumbnail_image_value'){ $p->meta[$i] = str_replace(array('http://wp.crazecdn.com/', 'https://wp.crazecdn.com/'), 'https://cdn.flixu.tv/', $m); }else{ $p->meta[$i] = $m; } } } if(!empty($cats)){ foreach($cats as $c){ $p->genres[] = $c->slug; } } $res = post_data($p); if($res && !empty($res->post_id)){ update_post_meta($p->ID, 'evg_exported', $res->post_id); echo $p->ID . ' - OK<br>'; }else{ echo $p->ID . ' - ERR<br>'; } } function post_data($post){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://omb.starwebltd.com/import_posts.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec($ch); curl_close ($ch); return $server_output ? json_decode($server_output) : FALSE; } ?>
[ CANCEL ]