10392

php get_headers is very slow (takes infinite!) when it requests the URI of current page

Question:

Why it takes an infinite amount of time for this ?

function getCurrentPageUrl() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } $headers = get_headers(getCurrentPageUrl());

Answer1:

It's a recursive request. The problem is that you are requesting to load this script and the script which is loading is trying to load it in its self an so on and so on :)

Recommend

  • Boost UDP asynchronous client receiving its own datagram
  • Why am I getting a segmentation fault in my C server program (but only sometimes)?
  • how to add a attribute in existing xml using vbscript
  • Apache ssl redirect using mod_rewrite
  • How to add Ajax on existing PHP & Mysql based pagination
  • Why is Firefox 6 ignoring my height, width, top and left settings in javascript window.open?
  • right format of php breadcrumb code
  • How to send POST request using html button
  • Accessing environment variables set using mod_rewrite in PHP
  • Wordpress header external php file - change title?
  • YII - how we can get the name of the method in init() function in controller?
  • jquery limit lines in a paragraph and apply three periods to the end
  • Linq to SQL left outer join using Lambda syntax and joining on 2 columns (composite join key)
  • DirectX game with no prerequisite software to run
  • NHibernate Lazy Loading Behaviour
  • Comma within fields in CSV file -import to DB using SSIS
  • Net-ssh session timeout
  • ASP.NET - Efficiently delay code execution for single request?
  • CHAR vs VARCHAR for password security
  • How can I sum two different columns at once where one contains Decimal objects in pandas?
  • How to develop MS CRM kind of application
  • SyntaxError: unterminated string literal … tag not working within a string variable
  • Removing the .php file extension from the URL Request
  • How do I create an image and save it for later to draw as texture in XNA?
  • Paypal 'Buy Now' button not letting me dynamically set the price
  • Insertion large number of Entities into SQL Server 2012 [duplicate]
  • Time out Error in send mail
  • Scanner nextInt() and hasNextInt() problems
  • ApplePay PKPaymentAuthorizationViewController always shows processing
  • Marklogic : Query response time is very high
  • How to use remove-erase idiom for removing empty vectors in a vector?
  • RectangularRangeIndicator format like triangular using dojo
  • angularjs unit test when to use $rootScope.$new()
  • Cross-Platform Protobuf Serialization
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • Revoking OAuth Access Token Results in 404 Not Found
  • Turn off referential integrity in Derby? is it possible?
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • JaxB to read class hierarchy