Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set( 'display_errors', "1" );
  4. ini_set( 'error_reporting', E_ALL | E_STRICT );
  5.  
  6. $start = microtime(true);
  7.  
  8. $c = curl_init( 'https://dashboard.wordpress.com/wp-admin/index.php' );
  9.  
  10. curl_setopt_array( $c, array(
  11. CURLOPT_HTTPHEADER => array(
  12. 'Authorization: Bearer 123',
  13. ),
  14. CURLOPT_RETURNTRANSFER => true,
  15. CURLOPT_HEADER => false,
  16. ) );
  17.  
  18. $response = curl_exec( $c );
  19.  
  20. if ( false !== stripos( $response, 'authorization_required' ) ) {
  21. // WordPress.com didn't see an Authorization header
  22.  
  23. echo "ERROR: No Authorization header was sent\n";
  24. exit( 1 );
  25. }
  26.  
  27. echo "SUCCESS: An Authoraziton header was sent after " . ((microtime(true) - $start)) . " seconds\n";
  28. echo "Response: " . print_r($response, 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement