Created
July 13, 2019 09:37
-
-
Save oterox/dcf426298ed3eb56feb4b6e638f3806b to your computer and use it in GitHub Desktop.
wp_remote_get proveedores API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$response = wp_remote_get( 'http://192.168.1.9:8080/users' ); | |
if ( is_array( $response ) ) { | |
$body = wp_remote_retrieve_body( $response ); | |
$data = json_decode( $body ); | |
if( ! empty( $data ) ) { | |
echo '<ul>'; | |
foreach( $data->objects as $product ) { | |
echo '<li>'; | |
echo '<a href="' . esc_url( $product->id ) . '">' . $product->email . '</a>'; | |
echo '</li>'; | |
} | |
echo '</ul>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment