Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8551863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:17:25+00:00 2026-06-11T14:17:25+00:00

I need to get the content starting from the doc type declaration until the

  • 0

I need to get the content starting from the doc type declaration until the end, this is what I have:

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 19 Sep 2012 07:52:41 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=20
Status: 200 OK
X-Runtime: 736
ETag: "66644f063945c4d3f6e5471723306c2c"
Cache-Control: no-cache
Set-Cookie: vrid=e93aae30-e45c-012f-9786-001f29cc11ee; domain=.yellowpages.com; path=/; expires=Tue, 19-Sep-2017 07:52:40 GMT
Set-Cookie: parity_analytics=---+%0A%3Avisit_id%3A+u1ncewtmt44s23myff9s5t1tbcd5h%0A%3Avisit_start_time%3A+2012-09-19+07%3A52%3A40.711499+%2B00%3A00%0A%3Alast_page_load%3A+2012-09-19+07%3A52%3A40.711501+%2B00%3A00%0A; path=/; expires=Sat, 19-Sep-2037 07:52:40 GMT
Set-Cookie: _parity_session=BAh7CDoPc2Vzc2lvbl9pZCIlMDIxNjZiMDVkZmMxNWFmMzQ5OGVlNTk3Njg0MTM2NmY6EF9jc3JmX3Rva2VuSSIxbVhHMGNmM1U1K3E1OFo2NTQwVHltTFdZaHREa1lMMnRCVnE1eVFJNFpHQT0GOgZFRjoTZGV4X3Nlc3Npb25faWRJIillOTg5ZjNlMC1lNDVjLTAxMmYtOTc4Yy0wMDFmMjljYzExZWUGOwdG--08b9db1ba698882287f47a60e34c0c1e227d440a; path=/; HttpOnly
X-Rid: vendetta-ac8a22f2-3a5c-4da8-a1e8-25d4a550bf32
Expires: Wed, 19 Sep 2012 07:52:40 GMT

<!DOCTYPE html><head></head><body></body>...

Can this be achieved with a regular expression??

Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:17:26+00:00Added an answer on June 11, 2026 at 2:17 pm

    You can use http_parse_headers

    Here’s example:

    $headers = substr($yourString, 0, strpos($yourString, '<!DOCTYPE'));
    print_r(http_parse_headers($headers));
    

    And here’s useful function from docs using Regex (in a case if you don’t have access to PECL library):

    function http_parse_headers( $header )
    {
        $retVal = array();
        $fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header));
        foreach( $fields as $field ) {
            if( preg_match('/([^:]+): (.+)/m', $field, $match) ) {
                $match[1] = preg_replace('/(?<=^|[\x09\x20\x2D])./e', 'strtoupper("\0")', strtolower(trim($match[1])));
                if( isset($retVal[$match[1]]) ) {
                    $retVal[$match[1]] = array($retVal[$match[1]], $match[2]);
                } else {
                    $retVal[$match[1]] = trim($match[2]);
                }
            }
        }
        return $retVal;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one variable whose content I need to get from a remote server,
I need to get the contents from this URL http://google.fr/ok in a NSString can
I use file_get_contents(http://www.mydomain.com); to get the content. Then I need to search through it
I need to clear the <div> and insert new content I get from the
I need to get whole content of iframe from the same domain. Whole content
I need to get the content of URL bar (of currently opened tab) of
I need to get the complete content of a column of two tables in
I need a method to get the data from an external editor. def _get_content():
How can I get content of a DIV using regular expression. What I need
I need to get the last string content of the url between / and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.