Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress How to Build a WordPress Plugin Connecting WordPress Plugins with 3rd Party APIs Getting and Storing JSON Code Challenge

suyash patankar
suyash patankar
2,310 Points

An incorrect feed URL was created.

Please check following code and help me to know why is it giving an error?

plugin.php
<?php

function my_plugin_get_profile($my_plugin_username)
{
  $json_feed_url = 'http://myapi.net' . $my_plugin_username . '.json';

  $args = array( 'timeout' => 120);

$json_feed = wp_remote_get( $json_feed_url, $args );

  return $json_feed;
}



?>

3 Answers

Joel Bardsley
Joel Bardsley
31,246 Points

Hi Suyash,

Using the 'MikeTheFrog' example for the username, In your code it appears as though you've concatenated $json_feed_url to be 'http://myapi.netMikeTheFrog.json', which isn't quite right.

If you're still stuck, double check the 'Bummer' warning message for what should be stored in the variable.

suyash patankar
suyash patankar
2,310 Points

hi, thank you for the reply, I had put '/' to make it 'http://myapi.net/MikeTheFrog.json

that too did not work.

suyash patankar
suyash patankar
2,310 Points

can any one help? this challenge is giving a lot of issues

Joel Bardsley
Joel Bardsley
31,246 Points

Hi suyash, I copied your code and have gone through each step of the code challenge again. On Task 2, it gave me the 'incorrect feed URL' error, which I was able to resolve by adding a forward slash to the end of http://myapi.net in your $json_feed_url variable.

From there on I was able to progress straight to Task 5 (the final task) without having to make further changes. It looks like you haven't been able to attempt that one yet, so I'll leave it in your capable hands.

Good luck! Joel

suyash patankar
suyash patankar
2,310 Points

Hi Joel

Thank you for the help, I resolved the challenge by rewriting code, I dont know how exactly I solved issue, but I had put '/' still it gave me an error.