I'm using $_REQUEST to get sent data to a page and page will return me some value, but right now only if i send data with GET, page will return me data And I need to send request with POST method.
This is the domain that i send request to: http://rapapp.mobi
example request: http://rapapp.mobi/?Slides=4
I have changed request_order in php.ini to both request_oder="GP" & request_order="PG" and tried but no luck!
Note:
If you send request to that domain with GET you will be redirected to another domain with same request but if you send request to that domain in POST you will be redirected to website index.
very specific: TCP port is open, if you send request to main domain on server both methods work. (Main domain: http://rapfarsi.com). And this problem started when i moved web files from Host to VPS.
Please help me whats going on? i need to send request with POST method
One of my functions that will return data
add_action('init' , 'Singles');
function Singles(){
if(!isset($_REQUEST['Singles'])) return;
$limitation = (int) $_REQUEST['Singles'];
$json = array();
header('Content-Type: application/json');
$args = array(
'cat' => 111,
'posts_per_page' => $limitation
);
// The Query
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$img = wp_get_attachment_url( get_post_thumbnail_id(get_the_ID) );
$the_query->the_post();
$json[] = array(
'id' => get_the_ID(),
'title' => get_the_title(),
'isSingle' => in_category(111,null),
'link' => get_the_permalink(),
'image' => wp_get_attachment_url(get_post_thumbnail_id(get_the_ID()))
);
}
} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
echo '{"items":'.json_encode($json).'}';
die();
}