Permalink
Browse files

Added errorhandling for failed Instagram-Api-Calls.

Added option to disable SSL-Verfication.
  • Loading branch information...
1 parent 5e6cf8f commit 6fec092cafc7d241c1b1d75e4a80b42d28eff2d5 @csenf committed Jan 15, 2013
Showing with 19 additions and 2 deletions.
  1. +10 −2 dsgnwrks-instagram-importer.php
  2. +9 −0 settings.php
@@ -198,8 +198,16 @@ public function import() {
protected function import_messages( $api_url, $settings, $prevmessages = array() ) {
$this->settings = $settings;
-
- $api = wp_remote_retrieve_body( wp_remote_get( $api_url ) );
+
+ $response = wp_remote_get( $api_url, array('sslverify' => !(bool)$settings['ssl_verify_off']) );
+
+ if (is_wp_error($response)) {
+ echo $response->get_error_message();
+ exit;
+ }
+
+ $api = wp_remote_retrieve_body( $response );
+
$data = json_decode( $api );
require_once(ABSPATH . 'wp-admin/includes/file.php');
View
@@ -394,6 +394,15 @@
}
+ ?><tr valign="top">
+ <th scope="row">
+ <label><strong>Disable SSL-Verification</strong><br/>Only for testing purposes</label>
+ </th>
+ <td>
+ <input type="checkbox" name="dsgnwrks_insta_options[<?php echo $id; ?>][ssl_verify_off]" <?php checked( isset( $o['ssl_verify_off'] ) ); ?> value="yes"/>
+ </td>
+ </tr>
+ <?php
echo '<input type="hidden" name="dsgnwrks_insta_options[username]" value="replaceme" />';
$userdata = array( 'access_token', 'bio', 'website', 'profile_picture', 'full_name', 'id', 'full_username' ) ;
foreach ( $userdata as $data ) {

1 comment on commit 6fec092

What is the purpose of the "Disable SSL-Verification" option?

Please sign in to comment.