• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_remote_retrieve_response_message函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_remote_retrieve_response_message函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_remote_retrieve_response_message函数的具体用法?PHP wp_remote_retrieve_response_message怎么用?PHP wp_remote_retrieve_response_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_remote_retrieve_response_message函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_api_response

 /**
  * Request data from the thir party API.
  *
  * @since 1.5.4
  * @param string $base_url 	Base URL where API is available
  * @param string $api_key 	API Key provided by this service
  * @param string $endpoint 	Method to request available from this service.
  * @param array $params 	Data to be passed to API
  * @return array|object 	The API response.
  */
 private function get_api_response($base_url, $api_key, $endpoint, $params = array())
 {
     // Exclude http:// from the user's input
     $request_uri = $this->api_protocol . '://' . preg_replace('#^https?://#', '', $base_url) . '/api/v' . $this->api_version . $endpoint;
     $params['timeout'] = 60;
     $params['body'] = isset($params['data']) && $params['data'] ? json_encode($params['data']) : '';
     $params['headers'] = array('Authorization' => 'TRUEREST apikey=' . $api_key);
     $response = wp_remote_get($request_uri, $params);
     $response_code = wp_remote_retrieve_response_code($response);
     $response_message = wp_remote_retrieve_response_message($response);
     $get_response = json_decode(wp_remote_retrieve_body($response), true);
     if (is_wp_error($response) || 200 != $response_code) {
         if (is_wp_error($response)) {
             $data['error'] = $response->get_error_message();
         } else {
             $data['error'] = isset($get_response['msg']) ? $get_response['msg'] : $response_code . ' - ' . $response_message;
         }
     } else {
         if ($get_response) {
             $data = $get_response;
         } else {
             $data = $response;
         }
     }
     return $data;
 }
开发者ID:nullality,项目名称:FEWD-SEA-7,代码行数:36,代码来源:class-fl-builder-service-campayn.php


示例2: remote_request

 /** 
  *	Send the api request to Brickset. Returns an XML formatted response.
  *
  *	@author		Nate Jacobs
  *	@since		0.1
  *	@updated	1.0
  *
  *	@param		string	url needed after base url
  *	@param		string	query parameters
  *
  *	@return		object	WP_Error
  *	@return		array
  */
 protected function remote_request($type, $extra_url, $params = '')
 {
     $api_url = 'http://www.brickset.com/webservices/brickset.asmx';
     if ('get' == $type) {
         //wp_die( $api_url.'/'.$extra_url.'?'.$params );
         $response = wp_remote_get($api_url . '/' . $extra_url . '?' . $params);
     } elseif ('post' == $type) {
         $response = wp_remote_post($api_url . '/' . $extra_url, $params);
     } else {
         return new WP_Error('no-type-specified', __('Specify a type of request: get or post', 'bs_api'));
     }
     // Did the HTTP request fail?
     if (is_wp_error($response)) {
         return $response;
     }
     $response_code = wp_remote_retrieve_response_code($response);
     $response_message = wp_remote_retrieve_response_message($response);
     $response_body = wp_remote_retrieve_body($response);
     if (200 != $response_code && !empty($response_message)) {
         return new WP_Error($response_code, __('Don\'t Panic! Something went wrong and Brickset didn\'t reply.', 'bs_api'));
     } elseif (200 != $response_code) {
         return new WP_Error($response_code, __('Unknown error occurred', 'bs_api'));
     } elseif ($extra_url != 'login' && 300 > strlen($response_body) && $type == 'get') {
         return new WP_Error('brickset-no-data', __('Sorry, no sets were found for that query', 'bs_api'));
     } else {
         return $response_body;
     }
 }
开发者ID:pedro-mendonca,项目名称:Brickset-API,代码行数:41,代码来源:class-utilities.php


示例3: uploadFile

 static function uploadFile($file_url, $path, $file_name)
 {
     $file_name = sanitize_file_name($file_name);
     $full_file_name = $path . DIRECTORY_SEPARATOR . $file_name;
     //Local name
     $response = wp_remote_get($file_url, array('timeout' => 10 * 60 * 60, 'stream' => true, 'filename' => $full_file_name));
     if (is_wp_error($response)) {
         @unlink($full_file_name);
         throw new Exception('Error: ' . $response->get_error_message());
     }
     if (200 != wp_remote_retrieve_response_code($response)) {
         @unlink($full_file_name);
         throw new Exception('Error 404: ' . trim(wp_remote_retrieve_response_message($response)));
     }
     if (substr($file_name, -12) == ".phpfile.txt") {
         $new_file_name = substr($file_name, 0, -12) . ".php";
         $new_file_name = $path . DIRECTORY_SEPARATOR . $new_file_name;
         $moved = @rename($full_file_name, $new_file_name);
         if ($moved) {
             return array('path' => $new_file_name);
         } else {
             @unlink($full_file_name);
             throw new Exception('Error: Copy file.');
         }
     }
     return array('path' => $full_file_name);
 }
开发者ID:HasClass0,项目名称:mainwp-child,代码行数:27,代码来源:MainWPHelper.class.php


示例4: smart_manager_validate_license_key

function smart_manager_validate_license_key()
{
    global $sm_base_name, $sm_check_update_timeout, $sm_plugin_data, $sm_sku, $sm_license_key, $sm_download_url, $sm_installed_version, $sm_live_version;
    $sm_license_key = isset($_REQUEST['license_key']) && !empty($_REQUEST['license_key']) ? $_REQUEST['license_key'] : '';
    $storeapps_validation_url = 'http://www.storeapps.org/wp-admin/admin-ajax.php?action=woocommerce_validate_serial_key&serial=' . urlencode($sm_license_key) . '&is_download=true&sku=' . $sm_sku;
    $resp_type = array('headers' => array('content-type' => 'application/text'));
    $response_info = wp_remote_post($storeapps_validation_url, $resp_type);
    //return WP_Error on response failure
    if (is_array($response_info)) {
        $response_code = wp_remote_retrieve_response_code($response_info);
        $response_msg = wp_remote_retrieve_response_message($response_info);
        // if ($response_code == 200 && $response_msg == 'OK') {
        if ($response_code == 200) {
            $storeapps_response = wp_remote_retrieve_body($response_info);
            $decoded_response = json_decode($storeapps_response);
            if ($decoded_response->is_valid == 1) {
                update_site_option('smart_manager_license_key', $sm_license_key);
                update_site_option('smart_manager_download_url', $decoded_response->download_url);
            } else {
                remove_license_download_url();
            }
            echo $storeapps_response;
            exit;
        }
        remove_license_download_url();
        echo json_encode(array('is_valid' => 0));
        exit;
    }
    remove_license_download_url();
    echo json_encode(array('is_valid' => 0));
    exit;
}
开发者ID:bulats,项目名称:chef,代码行数:32,代码来源:upgrade.php


示例5: check_email

 public function check_email($data = '')
 {
     if (empty($this->public_key)) {
         return new WP_Error('no_api_key', __('No API key was provided', 'awesome-support'));
     }
     if (empty($data)) {
         if (isset($_POST)) {
             $data = $_POST;
         } else {
             return new WP_Error('no_data', __('No data to check', 'awesome-support'));
         }
     }
     if (!isset($data['email'])) {
         return new WP_Error('no_email', __('No e-mail to check', 'awesome-support'));
     }
     global $wp_version;
     $args = array('timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'), 'blocking' => true, 'headers' => array('Authorization' => 'Basic ' . base64_encode('api:' . $this->public_key)), 'cookies' => array(), 'body' => array('address' => $data['email']), 'compress' => false, 'decompress' => true, 'sslverify' => true, 'stream' => false, 'filename' => null);
     $response = wp_remote_get(esc_url($this->endpoint), $args);
     $response_code = wp_remote_retrieve_response_code($response);
     if (is_wp_error($response)) {
         return $response;
     }
     if (200 != $response_code) {
         return new WP_Error($response_code, wp_remote_retrieve_response_message($response));
     }
     $body = wp_remote_retrieve_body($response);
     return $body;
 }
开发者ID:f4bsch,项目名称:Awesome-Support,代码行数:28,代码来源:class-mailgun-email-check.php


示例6: wclv_get_repos

function wclv_get_repos($username)
{
    $response = wp_remote_get("https://api.github.com/users/{$username}/repos");
    if ('200' != wp_remote_retrieve_response_code($response)) {
        return wp_remote_retrieve_response_message($response);
    }
    // Error retrieving repos
    $body = wp_remote_retrieve_body($response);
    $body = json_decode($body);
    return $body;
}
开发者ID:joseluis3228,项目名称:2012-WordCamp-Las-Vegas-API-Demo,代码行数:11,代码来源:wclv-2012-demo.php


示例7: callAPI

function callAPI($url)
{
    // FIXME set timeout, useragent, etc.
    $api_response = wp_remote_get($url);
    $rsp_code = wp_remote_retrieve_response_code($api_response);
    $rsp_msg = wp_remote_retrieve_response_message($api_response);
    $rsp_body = wp_remote_retrieve_body($api_response);
    // If request wasn't successfull return error.
    if ($rsp_code != 200) {
        return new WP_ERROR('api_call_failed', "Failed calling " . $url, $rsp_msg);
    }
    return new APIResponse($rsp_body);
}
开发者ID:realraum,项目名称:wp_spacestatus,代码行数:13,代码来源:space_api.php


示例8: countryCode

function countryCode($ip = '')
{
    if (!$ip) {
        $ip = $_SERVER['REMOTE_ADDR'];
    }
    $response = @wp_remote_get("http://ipinfo.io/" . $ip . "/json");
    if (200 == wp_remote_retrieve_response_code($response) && 'OK' == wp_remote_retrieve_response_message($response) && !is_wp_error($response)) {
        $data = json_decode($response['body'], 1);
        return $data['country'];
        //code
    }
    return false;
}
开发者ID:andrewkhunn,项目名称:lancero,代码行数:13,代码来源:Log_Database.php


示例9: makeRequest

 public function makeRequest($method, $url, $params = null)
 {
     $method = strtolower($method);
     $headers = self::getHeaders();
     $credentials = Config::getCredentials();
     if (empty($credentials) || empty($credentials['login']) || empty($credentials['apiToken'])) {
         throw new ApiException("Authorization error. Please ensure your login and API Token credentials are correct.");
     }
     $headers['Authorization'] = 'Basic ' . base64_encode($credentials['login'] . ':' . $credentials['apiToken']);
     $opts = array('timeout' => Config::DEFAULT_REQUEST_TIMEOUT, 'headers' => $headers);
     switch ($method) {
         case 'get':
             if (count($params) > 0) {
                 $url = "{$url}?" . http_build_query($params, null, '&');
             }
             $response = wp_remote_get($url, $opts);
             break;
         case 'post':
             $opts['body'] = json_encode($params);
             $response = wp_remote_post($url, $opts);
             break;
         case 'delete':
             $opts['method'] = 'DELETE';
             if (count($params) > 0) {
                 $url = "{$url}?" . http_build_query($params, null, '&');
             }
             $response = wp_remote_request($url, $opts);
             break;
         case 'put':
             $opts['method'] = 'PUT';
             $opts['body'] = json_encode($params);
             $response = wp_remote_request($url, $opts);
             break;
         default:
             throw new ApiException("Unrecognized API Method: {$method}");
     }
     $response_code = wp_remote_retrieve_response_code($response);
     if ($response_code < 200 || $response_code >= 300) {
         $message = wp_remote_retrieve_response_message($response);
         if (empty($message)) {
             $message = "API Error ({$httpCode})";
         }
         throw new ApiException($message, $response_code);
     }
     try {
         $result = json_decode(wp_remote_retrieve_body($response), true);
     } catch (Exception $e) {
         throw new ApiException("Invalid API Response: " . wp_remote_retrieve_body($response), $response_code);
     }
     return $result;
 }
开发者ID:hengwoon,项目名称:reamaze-api-client-php,代码行数:51,代码来源:WpHttpClient.php


示例10: process_signup

 /**
  * Process registration
  *
  * @since 2.1
  */
 public function process_signup()
 {
     global $rcp_options;
     $args = array('USER' => $this->username, 'PWD' => $this->password, 'SIGNATURE' => $this->signature, 'VERSION' => '124', 'METHOD' => $this->auto_renew ? 'CreateRecurringPaymentsProfile' : 'DoDirectPayment', 'AMT' => $this->amount, 'CURRENCYCODE' => strtoupper($this->currency), 'SHIPPINGAMT' => 0, 'TAXAMT' => 0, 'DESC' => $this->subscription_name, 'SOFTDESCRIPTOR' => get_bloginfo('name') . ' - ' . $this->subscription_name, 'SOFTDESCRIPTORCITY' => get_bloginfo('admin_email'), 'CUSTOM' => $this->user_id, 'NOTIFYURL' => add_query_arg('listener', 'EIPN', home_url('index.php')), 'EMAIL' => $this->email, 'CREDITCARDTYPE' => '', 'ACCT' => sanitize_text_field($_POST['rcp_card_number']), 'EXPDATE' => sanitize_text_field($_POST['rcp_card_exp_month'] . $_POST['rcp_card_exp_year']), 'CVV2' => sanitize_text_field($_POST['rcp_card_cvc']), 'ZIP' => sanitize_text_field($_POST['rcp_card_zip']), 'BUTTONSOURCE' => 'EasyDigitalDownloads_SP', 'PROFILESTARTDATE' => date('Y-m-d\\TH:i:s', strtotime('+' . $this->length . ' ' . $this->length_unit, time())), 'BILLINGPERIOD' => ucwords($this->length_unit), 'BILLINGFREQUENCY' => $this->length, 'FAILEDINITAMTACTION' => 'CancelOnFailure', 'TOTALBILLINGCYCLES' => $this->auto_renew ? 0 : 1);
     if ($this->auto_renew) {
         $initamt = round($this->amount + $this->signup_fee, 2);
         if ($initamt >= 0) {
             $args['INITAMT'] = $initamt;
         }
     }
     $request = wp_remote_post($this->api_endpoint, array('timeout' => 45, 'sslverify' => false, 'httpversion' => '1.1', 'body' => $args));
     $body = wp_remote_retrieve_body($request);
     $code = wp_remote_retrieve_response_code($request);
     $message = wp_remote_retrieve_response_message($request);
     if (is_wp_error($request)) {
         do_action('rcp_paypal_pro_signup_payment_failed', $request, $this);
         $error = '<p>' . __('An unidentified error occurred.', 'rcp') . '</p>';
         $error .= '<p>' . $request->get_error_message() . '</p>';
         wp_die($error, __('Error', 'rcp'), array('response' => '401'));
     } elseif (200 == $code && 'OK' == $message) {
         if (is_string($body)) {
             wp_parse_str($body, $body);
         }
         if (false !== strpos(strtolower($body['ACK']), 'failure')) {
             do_action('rcp_paypal_pro_signup_payment_failed', $request, $this);
             $error = '<p>' . __('PayPal subscription creation failed.', 'rcp') . '</p>';
             $error .= '<p>' . __('Error message:', 'rcp') . ' ' . $body['L_LONGMESSAGE0'] . '</p>';
             $error .= '<p>' . __('Error code:', 'rcp') . ' ' . $body['L_ERRORCODE0'] . '</p>';
             wp_die($error, __('Error', 'rcp'), array('response' => '401'));
         } else {
             // Successful signup
             $member = new RCP_Member($this->user_id);
             if ($member->just_upgraded() && rcp_can_member_cancel($member->ID)) {
                 $cancelled = rcp_cancel_member_payment_profile($member->ID, false);
             }
             if (isset($body['PROFILEID'])) {
                 $member->set_payment_profile_id($body['PROFILEID']);
             }
             if (isset($body['PROFILESTATUS']) && 'ActiveProfile' === $body['PROFILESTATUS']) {
                 // Confirm a one-time payment
                 $member->renew($this->auto_renew);
             }
             wp_redirect(esc_url_raw(rcp_get_return_url()));
             exit;
             exit;
         }
     } else {
         wp_die(__('Something has gone wrong, please try again', 'rcp'), __('Error', 'rcp'), array('back_link' => true, 'response' => '401'));
     }
 }
开发者ID:restrictcontentpro,项目名称:restrict-content-pro,代码行数:55,代码来源:class-rcp-payment-gateway-paypal-pro.php


示例11: validate_raw_response

 /**
  * @param object $response
  * @return boolean
  */
 private function validate_raw_response($response)
 {
     // make sure response came back okay
     if (is_wp_error($response)) {
         $this->error_message = $response->get_error_message();
         return false;
     }
     // check response code, should be 200
     $response_code = wp_remote_retrieve_response_code($response);
     if (false === strstr($response_code, '200')) {
         $response_message = wp_remote_retrieve_response_message($response);
         $this->error_message = "{$response_code} {$response_message}";
         return false;
     }
     return true;
 }
开发者ID:johnreytepacia,项目名称:etarticles,代码行数:20,代码来源:class-api-request.php


示例12: call_http

function call_http()
{
    // if submit button clicked, make the call
    if (isset($_POST['call-submitted'])) {
        // sanitize form values
        $name = sanitize_text_field($_POST["call-name"]);
        $email = sanitize_email($_POST["call-email"]);
        $application = sanitize_text_field($_POST["call-application"]);
        $password = sanitize_text_field($_POST["http-password"]);
        // UCD test site
        // $url = 'https://rtpucd01-srv.tivlab.raleigh.ibm.com:8443/cli/application/';
        // vLaunch test site
        $url = 'https://vlaunch.rtp.raleigh.ibm.com/groups';
        // vLaunch create VM
        // $url = 'https://vlaunch.rtp.raleigh.ibm.com/newrequests/RTP/1/createVM';
        $args = array('headers' => array('Authorization' => 'Basic ' . base64_encode($name . ':' . $password)), 'sslverify' => false);
        // end arg definition
        $response = wp_remote_get($url, $args);
        $msg = wp_remote_retrieve_response_message($response);
        // If not empty, display message
        if (!empty($msg)) {
            echo 'Message: <pre>';
            print_r($msg);
            echo '</pre>';
        }
        $http_code = wp_remote_retrieve_response_code($response);
        if (!empty($http_code)) {
            echo 'Code: <pre>';
            print_r($http_code);
            echo '</pre>';
        }
        // Display result
        if ($http_code == '200') {
            echo '<p>Success!</p>';
        } else {
            echo '<p>An unexpected error occurred</p>';
        }
        echo 'Response: <pre>';
        print_r($response);
        // var_dump ($response);
        echo '</pre>';
        $body = wp_remote_retrieve_body($response);
        echo '<p>Body:' . $body . '</p>';
    }
    // end isset($_POST['call-submitted'])
}
开发者ID:jbeegle,项目名称:wp_it_app,代码行数:46,代码来源:wwit-call.php


示例13: test

 /**
  * Test the WP Cron spawning system and report back its status.
  *
  * This command tests the spawning system by performing the following steps:
  *
  * * Checks to see if the `DISABLE_WP_CRON` constant is set; errors if true
  * because WP-Cron is disabled.
  * * Checks to see if the `ALTERNATE_WP_CRON` constant is set; warns if true.
  * * Attempts to spawn WP-Cron over HTTP; warns if non 200 response code is
  * returned.
  *
  * ## EXAMPLES
  *
  *     # Cron test runs successfully.
  *     $ wp cron test
  *     Success: WP-Cron spawning is working as expected.
  */
 public function test()
 {
     if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) {
         WP_CLI::error('The DISABLE_WP_CRON constant is set to true. WP-Cron spawning is disabled.');
     }
     if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) {
         WP_CLI::warning('The ALTERNATE_WP_CRON constant is set to true. WP-Cron spawning is not asynchronous.');
     }
     $spawn = self::get_cron_spawn();
     if (is_wp_error($spawn)) {
         WP_CLI::error(sprintf('WP-Cron spawn failed with error: %s', $spawn->get_error_message()));
     }
     $code = wp_remote_retrieve_response_code($spawn);
     $message = wp_remote_retrieve_response_message($spawn);
     if (200 === $code) {
         WP_CLI::success('WP-Cron spawning is working as expected.');
     } else {
         WP_CLI::warning(sprintf('WP-Cron spawn succeeded but returned HTTP status code: %1$s %2$s', $code, $message));
     }
 }
开发者ID:wp-cli,项目名称:wp-cli,代码行数:37,代码来源:cron.php


示例14: make_request

 /**
  * Makes an HTTP request using WordPress' WP_Http class and related functions.
  *
  * @param RESTian_Request $request
  * @param RESTian_Response $response
  * @return RESTian_Response
  */
 function make_request($request, $response)
 {
     switch ($request->http_method) {
         case 'GET':
             $url = $request->get_url();
             $args = $this->get_args($request);
             $result = wp_remote_get($url, $args);
             break;
         case 'POST':
             if ($content_type = $request->get_content_type()) {
                 $request->add_header('Content-type', $content_type);
             }
             $url = $request->get_url();
             $args = $this->get_args($request);
             $result = wp_remote_post($url, $args);
             break;
         case 'PUT':
             $result = new WP_Error(-1, 'HTTP PUT not yet supported.');
             break;
         case 'DELETE':
             $result = new WP_Error(-2, 'HTTP DELETE not yet supported.');
             break;
     }
     if (method_exists($request->client, 'filter_result')) {
         $result = $request->client->filter_result($result, $response);
     }
     if (is_wp_error($result)) {
         /**
          * These errors likely won't be 100% compatible with the errors from CURL when standalone
          */
         $error_num = $result->get_error_code();
         $response->set_http_error($error_num, $result->get_error_message($error_num));
     } else {
         $response->message = wp_remote_retrieve_response_message($result);
     }
     $response->status_code = wp_remote_retrieve_response_code($result);
     $response->body = wp_remote_retrieve_body($result);
     $response->body = $request->client->apply_filters('result_body', $response->body, $response);
     $response->result = $result;
     return $response;
 }
开发者ID:newclarity,项目名称:restian,代码行数:48,代码来源:wordpress-http-agent.php


示例15: process

 function process()
 {
     global $wp_version, $wpdb, $wpmudev_un;
     $mysql_vars = array('key_buffer_size' => true, 'max_allowed_packet' => false, 'max_connections' => false, 'query_cache_limit' => true, 'query_cache_size' => true, 'query_cache_type' => 'ON');
     $variables = $wpdb->get_results("\n\t\t\tSHOW VARIABLES\n\t\t\tWHERE Variable_name IN ( '" . implode("', '", array_keys($mysql_vars)) . "' )\n\t\t");
     if (is_resource($wpdb->dbh)) {
         $version = mysql_get_server_info($wpdb->dbh);
         $driver = 'mysql';
     } else {
         if (is_object($wpdb->dbh) and method_exists($wpdb->dbh, 'db_version')) {
             $version = $wpdb->dbh->db_version();
             $driver = get_class($wpdb->dbh);
         } else {
             $version = $driver = '<span class="qm-warn">' . __('Unknown', 'wpmudev') . '</span>';
         }
     }
     $this->data['db'] = array('version' => $version, 'driver' => $driver, 'vars' => $mysql_vars, 'variables' => $variables);
     $this->data['php']['version'] = phpversion();
     foreach ($this->php_vars as $setting) {
         $this->data['php']['variables'][$setting] = @ini_get($setting);
     }
     $this->data['php']['extensions'] = get_loaded_extensions();
     natcasesort($this->data['php']['extensions']);
     $this->data['php']['error_reporting'] = error_reporting();
     # @TODO put WP's other debugging constants in here, eg. SCRIPT_DEBUG
     $this->data['wp'] = array('Version' => $wp_version, 'ABSPATH' => self::format_constant('ABSPATH'), 'WP_CONTENT_DIR' => self::format_constant('WP_CONTENT_DIR'), 'WP_PLUGINS_DIR' => self::format_constant('WP_PLUGINS_DIR'), 'SUNRISE' => self::format_constant('SUNRISE'), 'UPLOADBLOGSDIR' => self::format_constant('UPLOADBLOGSDIR'), 'UPLOADS' => self::format_constant('UPLOADS'), 'SUBDOMAIN_INSTALL' => self::format_constant('SUBDOMAIN_INSTALL'), 'DOMAIN_CURRENT_SITE' => self::format_constant('DOMAIN_CURRENT_SITE'), 'PATH_CURRENT_SITE' => self::format_constant('PATH_CURRENT_SITE'), 'SITE_ID_CURRENT_SITE' => self::format_constant('SITE_ID_CURRENT_SITE'), 'BLOGID_CURRENT_SITE' => self::format_constant('BLOGID_CURRENT_SITE'), 'COOKIE_DOMAIN' => self::format_constant('COOKIE_DOMAIN'), 'COOKIEPATH' => self::format_constant('COOKIEPATH'), 'SITECOOKIEPATH' => self::format_constant('SITECOOKIEPATH'), 'DISABLE_WP_CRON' => self::format_constant('DISABLE_WP_CRON'), 'ALTERNATE_WP_CRON' => self::format_constant('ALTERNATE_WP_CRON'), 'DISALLOW_FILE_MODS' => self::format_constant('DISALLOW_FILE_MODS'), 'WP_HTTP_BLOCK_EXTERNAL' => self::format_constant('WP_HTTP_BLOCK_EXTERNAL'), 'WP_ACCESSIBLE_HOSTS' => self::format_constant('WP_ACCESSIBLE_HOSTS'));
     $server = explode(' ', $_SERVER['SERVER_SOFTWARE']);
     $server = explode('/', reset($server));
     if (isset($server[1])) {
         $server_version = $server[1];
     } else {
         $server_version = 'Unknown';
     }
     $this->data['server'] = array('name' => $server[0], 'version' => $server_version, 'address' => $_SERVER['SERVER_ADDR'], 'host' => @php_uname('n'));
     $remote_get = wp_remote_get($wpmudev_un->server_url);
     $remote_post = wp_remote_post($wpmudev_un->server_url);
     $remote_paypal = wp_remote_post("https://api-3t.paypal.com/nvp", array('body' => '"METHOD=SetExpressCheckout&VERSION=63.0&USER=xxxxx&PWD=xxxxx&SIGNATURE=xxxxx'));
     $this->data['remote']['WPMU DEV: GET'] = is_wp_error($remote_get) ? $remote_get->get_error_message() : wp_remote_retrieve_response_message($remote_get);
     $this->data['remote']['WPMU DEV: POST'] = is_wp_error($remote_post) ? $remote_post->get_error_message() : wp_remote_retrieve_response_message($remote_post);
     $this->data['remote']['PayPal API: POST'] = is_wp_error($remote_paypal) ? $remote_paypal->get_error_message() : wp_remote_retrieve_response_message($remote_paypal);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:41,代码来源:debug.php


示例16: download_url

 function download_url($url, $timeout = 300)
 {
     //WARNING: The file is not automatically deleted, The script must unlink() the file.
     if (!$url) {
         return new WP_Error('http_no_url', __('Invalid URL Provided.', 'themify-flow'));
     }
     $tmpfname = wp_tempnam($url);
     if (!$tmpfname) {
         return new WP_Error('http_no_file', __('Could not create Temporary file.', 'themify-flow'));
     }
     $response = wp_safe_remote_get($url, array('cookies' => $this->cookies, 'timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname));
     if (is_wp_error($response)) {
         unlink($tmpfname);
         return $response;
     }
     if (200 != wp_remote_retrieve_response_code($response)) {
         unlink($tmpfname);
         return new WP_Error('http_404', trim(wp_remote_retrieve_response_message($response)));
     }
     return $tmpfname;
 }
开发者ID:jhostetter,项目名称:wp_intern_themes,代码行数:21,代码来源:class-tf-upgrader.php


示例17: check_error

function check_error($response)
{
    $msg = wp_remote_retrieve_response_message($response);
    $code = wp_remote_retrieve_response_code($response);
    echo '<br>Code = ' . $code . ', ' . $msg;
    switch ($code) {
        case '200':
            echo ' - Success!';
            break;
        case '201':
            $body = wp_remote_retrieve_body($response);
            echo '<br>';
            print_r($body);
            break;
        case '401':
            echo ' - Insufficient privileges, bad credentials, or malformed request.';
            break;
        case '404':
            echo ' - Endpoint does not exist.';
            break;
        case '413':
            //      echo ' - Request Entity too Large.';
            break;
        case '422':
            echo ' - No valid search predicate.';
            break;
        default:
            echo 'Unexpected error';
    }
    if ($code !== 200) {
        // Print error from response body
        $body = wp_remote_retrieve_body($response);
        echo '<br>';
        print_r($body);
    }
    // end $code !== 200
    echo '<br>';
    return $code;
}
开发者ID:jbeegle,项目名称:wp_it_app,代码行数:39,代码来源:wwit-vm-deploy.php


示例18: download

 protected static function download($url, $timeout = 300)
 {
     //WARNING: The file is not automatically deleted, The script must unlink() the file.
     if (!$url) {
         return new WP_Error('http_no_url', __('Invalid URL Provided.', 'wp-e-commerce'));
     }
     $tmpfname = wp_tempnam($url);
     if (!$tmpfname) {
         return new WP_Error('http_no_file', __('Could not create Temporary file.', 'wp-e-commerce'));
     }
     $args = array('timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname, 'headers' => array('X-WP-Domain' => Sputnik_API::domain()), 'user-agent' => 'WP eCommerce Marketplace: ' . WPSC_VERSION);
     Sputnik_API::sign_download($url, $args);
     $response = wp_safe_remote_get($url, $args);
     if (is_wp_error($response)) {
         unlink($tmpfname);
         return $response;
     }
     if (200 != wp_remote_retrieve_response_code($response)) {
         unlink($tmpfname);
         return new WP_Error('http_404', trim(wp_remote_retrieve_response_message($response)));
     }
     return $tmpfname;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:23,代码来源:Upgrader.php


示例19: remote

 public static function remote($url = FALSE, $post_vars = FALSE, $args = FALSE, $return = FALSE)
 {
     if ($url && is_string($url)) {
         $args = !is_array($args) ? array() : $args;
         /* Force array, and disable SSL verification. */
         $args["sslverify"] = !isset($args["sslverify"]) ? false : $args["sslverify"];
         /**/
         if ((is_array($post_vars) || is_string($post_vars)) && !empty($post_vars)) {
             $args = array_merge($args, array("method" => "POST", "body" => $post_vars));
         }
         /**/
         $response = wp_remote_request($url, $args);
         /* Process the remote request now. */
         /**/
         if (strcasecmp((string) $return, "array") === 0 && !is_wp_error($response) && is_array($response)) {
             $a = array("code" => (int) wp_remote_retrieve_response_code($response));
             $a = array_merge($a, array("message" => wp_remote_retrieve_response_message($response)));
             $a = array_merge($a, array("headers" => wp_remote_retrieve_headers($response)));
             $a = array_merge($a, array("body" => wp_remote_retrieve_body($response)));
             $a = array_merge($a, array("response" => $response));
             /**/
             return $a;
         } else {
             if (!is_wp_error($response) && is_array($response)) {
                 return wp_remote_retrieve_body($response);
             } else {
                 /* Else this remote request has failed completely. Return false. */
                 return false;
             }
         }
         /* Remote request failed, return false. */
     } else {
         /* Else, return false. */
         return false;
     }
 }
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:36,代码来源:utils-urls.inc.php


示例20: pull_updates

 /**
  * Check for new messages.
  *
  * @return array|WP_Error Array of new messages or error.
  */
 public function pull_updates()
 {
     $response = $this->client->get_undelivered_updates();
     if (is_wp_error($response)) {
         return $response;
     }
     if (200 != wp_remote_retrieve_response_code($response)) {
         return new WP_Error(Prompt_Enum_Error_Codes::INBOUND, wp_remote_retrieve_response_message($response), $response);
     }
     $data = json_decode($response['body']);
     if (!isset($data->updates)) {
         return new WP_Error(Prompt_Enum_Error_Codes::INBOUND, __('Inbound messages arrived in an unrecognized format.', 'Postmatic'), $data);
     }
     if (!$data->updates) {
         $data->updates = array();
     }
     $result_updates = array();
     foreach ($data->updates as $update) {
         $result = array('id' => $update->id);
         $result['status'] = $this->process_update($update);
         $result_updates[] = $result;
     }
     return array('updates' => $result_updates);
 }
开发者ID:postmatic,项目名称:beta-dist,代码行数:29,代码来源:inbound-messenger.php



注:本文中的wp_remote_retrieve_response_message函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_removable_query_args函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_remote_retrieve_response_code函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap