Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors',1);
- error_reporting(E_ALL);
- function exception_error_handler($severity, $message, $file, $line) {
- if (!error_reporting()) {
- return;
- }
- error_log("$severity, $message, $file, $line");
- $exception = new ErrorException($message, 0, $severity, $file, $line);
- var_dump($exception);
- throw $exception;
- exit();
- }
- set_error_handler("exception_error_handler");
- $url = 'https://api.wordpress.org/themes/update-check/1.1/';
- $r = array (
- "method"=>
- "POST",
- "timeout"=>
- 3,
- "redirection"=>
- 5,
- "httpversion"=>
- "1.0",
- "blocking"=>
- true,
- "headers"=>
- array(
- "Accept-Encoding"=>
- "deflate;q=1.0, compress;q=0.5, gzip;q=0.5",
- "Content-Type"=>
- "application/x-www-form-urlencoded; charset=UTF-8",
- "Content-Length"=>
- 899
- ),
- "body"=>
- "plugins=%7B%22plugins%22%3A%5B%5D%2C%22active%22%3A%5B%5D%7D&translations=%7B%22akismet%22%3A%7B%22en_GB%22%3A%7B%22POT-Creation-Date%22%3A%22%22%2C%22PO-Revision-Date%22%3A%222016-05-12+18%3A04%3A18%2B0000%22%2C%22Project-Id-Version%22%3A%22Stable+%28latest+release%29%22%2C%22X-Generator%22%3A%22GlotPress%5C%2F2.1.0-alpha%22%7D%7D%2C%22woocommerce%22%3A%7B%22en_GB%22%3A%7B%22POT-Creation-Date%22%3A%22%22%2C%22PO-Revision-Date%22%3A%222016-05-18+11%3A04%3A13%2B0000%22%2C%22Project-Id-Version%22%3A%22Stable+%28latest+release%29%22%2C%22X-Generator%22%3A%22GlotPress%5C%2F2.1.0-alpha%22%7D%7D%2C%22wp-super-cache%22%3A%7B%22en_GB%22%3A%7B%22POT-Creation-Date%22%3A%22%22%2C%22PO-Revision-Date%22%3A%222016-05-09+15%3A03%3A03%2B0000%22%2C%22Project-Id-Version%22%3A%22Stable+%28latest+release%29%22%2C%22X-Generator%22%3A%22GlotPress%5C%2F2.1.0-alpha%22%7D%7D%7D&locale=%5B%22en_GB%22%5D&all=true",
- "cookies"=>
- array(),
- "user-agent"=>
- "WordPress/4.5.2; https://www.domain.con/wordpress",
- "reject_unsafe_urls"=>
- false,
- "compress"=>
- false,
- "decompress"=>
- true,
- "sslverify"=>
- false,
- "sslcertificates"=>
- dirname(__FILE__)."/wordpress/wp-includes/certificates/ca-bundle.crt",
- "stream"=>
- false,
- "filename"=>
- NULL,
- "limit_response_size"=>
- NULL,
- "_redirection"=>
- 5,
- "ssl"=>
- true,
- "local"=>
- false
- );
- $handle = curl_init();
- $timeout = (int) ceil( $r['timeout'] );
- $ssl_verify = isset($r['sslverify']) && $r['sslverify'];
- curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
- curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
- curl_setopt( $handle, CURLOPT_URL, $url);
- curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
- curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( $ssl_verify === true ) ? 2 : false );
- curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
- curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false );
- curl_setopt( $handle, CURLOPT_POST, true );
- curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
- curl_setopt( $handle, CURLOPT_HEADER, false );
- $res = curl_exec( $handle );
- var_dump($res);
- $a = curl_errno( $handle );
- var_dump($a);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement