• Resolved nata-lee

    (@nata-lee)


    Hello!

    I’m trying to use wp_remote_get() to get an image file, but the $response is very strange. $response[‘body’] is …. (4 dots) and there are no else elements.

    What do I do wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    You don’t anything wrong, it’s just an array answer (it will show results by number like [1] = stuff1, [2] stuff2 so on.

    To display it in page, you just need to process it, like:

    $php_array = wp_remote_get();

    echo $php_array[1];
    echo $php_array[2]; so on

    in general arrays are called with loops like, if $php_array not empty, display the next line of table.

    to show it in your page, and verify data is ok (and see all lines in table/array), use something like:

    $php_array = wp_remote_get();
    print_r($php_array);

    If it works well, will display the data inside in a big blurby line. Data to be called and displayed like i showed at first. Many tutorials on the net and codex with this problem. It’s a very complex one at first because, a single $code thing can be 4D, containing 2×5 columns like in excel for example. it’s a full table or array for a single call in php like $this_custom_array();. Took me ages to understand.

    Hope it helps,

    Thread Starter nata-lee

    (@nata-lee)

    Thank you very much!
    I’ve got everything I need.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_remote_get returns …’ is closed to new replies.