0

so here in the below code im calling nytimes api

<?php

function rpnyt_article_get_result( $rpnyt_search , $rpnyt_key ){

 $rpnyt_url = 'https://api.nytimes.com/svc/search/v2/articlesearch.json?q='.$rpnyt_search.'&api-key='.$rpnyt_key ;
 $json_feed = wp_remote_get($rpnyt_url);

 var_dump($json_feed[ 'body']);

}

?>

im getting response back as expected but that includes file url from where im calling this function like /home/ubuntu/XXXXXXXXX/xxxxxxxxxxxx/plugins/XXxxx/includes/rpnyt-news-content.php:8:(see image) enter image description here

user5323957
  • 542
  • 1
  • 9
  • 21

2 Answers2

1

Try var_export() instead of var_dump().

http://php.net/manual/en/function.var-export.php

azbatuk
  • 273
  • 1
  • 6
1

Consider using

echo(json_encode($your_thing));
Felipe Valdes
  • 1,998
  • 15
  • 26