Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Use wp_remote_get instead of curl
Index: github_gist_wordpress_plugin.php
===================================================================
--- github_gist_wordpress_plugin.php (revision 517091)
+++ github_gist_wordpress_plugin.php (working copy)
@@ -46,13 +46,12 @@
}
function get_content_from_url($url) {
- $ch = curl_init();
- curl_setopt($ch,CURLOPT_URL,$url);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1);
- $content = curl_exec($ch);
- curl_close($ch);
- return $content;
+ $response = wp_remote_get($url);
+ if( is_wp_error( $response ) ) {
+ return '';
+ } else {
+ return $response['body'];
+ }
}
function gist_raw($id, $file) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.