how get number of twitter followers in wordpress

You would replace this: $dataOrig = file_get_contents(‘http://twitter.com/users/show/’.$twitter_user); if (is_wp_error($dataOrig)) { return ‘Error!!!’; }else{ $profile = new SimpleXMLElement ( $dataOrig ); $countOrig = $profile->followers_count; $count = strval ( $countOrig ); } With this: $dataOrig = wp_remote_get(‘http://twitter.com/users/show/’.$twitter_user); if (is_wp_error($dataOrig)) { return ‘Error!!!’; } else { $profile = new SimpleXMLElement ( $dataOrig[‘body’] ); $countOrig = $profile->followers_count; $count = … Read more

Wrapping add_query_arg with esc_url not working

And the strange part: both codes echo the same string for $url!!! No, they don’t. Look at the page source. esc_url() is encoding the & control character. You can’t do that and expect the HTTP request to work correctly. Use esc_url_raw() instead. Note the description in the Codex concerning that function: The esc_url_raw() function is … Read more

@file_get_contents and wp_remote_get

Check the docs. file_get_contents() and wp_remote_get() are not equivalent. file_get_contents() returns a string. wp_remote_get() returns either an array or a WP_Error object. You need to look at wp_remote_post() to see the format of that array: Array ( [headers] => Array ( [date] => Thu, 30 Sep 2010 15:16:36 GMT [server] => Apache [x-powered-by] => PHP/5.3.3 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)