wp_remote_get vs. fetch_feed ? which is the better for performance?

Neither are high performance, and they do different things. fetch_feed is for grabbing feeds RSS feeds etc, wp_remote_get is for grabbing arbitrary items. Neither are fast, and the performance difference between each is negligible or irrelevant, but technically fetch_feed is slower than wp_remote_get, not because it’s faster or slower at grabbing over the network, but … Read more

wp_remote_get() not retrieving pages properly

The HTTP request sent by wp_remote_get() is different from the one that a browser sends. E.g the user-agent is different (see documentation). Some websites respond differently based on this. The second argument of wp_remote_get() allows one to alter the request. Websites might also respond differently depending on the IP or the number of requests received … Read more

rewrite script to use wp_remote_get instead of file_get_contents_curl

You can try this: foreach( $posts as $post ) { $url = sprintf( ‘http://graph.facebook.com/?id=%s’, get_permalink( $post->ID ) ); $response = wp_remote_get( $url, array( ‘timeout’ => 15 ) ); if( ! is_wp_error( $response ) && isset( $response[‘response’][‘code’] ) && 200 === $response[‘response’][‘code’] ) { $body = wp_remote_retrieve_body( $response ); $fb = json_decode( $body ); if( ! … Read more