Jump to content

need some help php header request output


richard2014

Recommended Posts

Hallo,

 

i need some help with the scripts for a http header request. In the first script you can type the URL and the second shows the information of the header. The output produce an array.  I will change this output style with css. How I can manipulate the data output?

Here is the code:

url.php

<table width="65%" border="0" align="center" cellpadding="1" cellspacing="1">
  <tr bgcolor="#DFDFFF">

        <td> <form name="Form" method="post" action="empfangeURL.php">

        <p>URL:
          <input name="url" type="text" value="http://">

        </p>
        <p>
          <input type="submit" name="Submit" value="Senden">
          <input type="reset" name="Submit2" value="Reset">
        </p>
      </form>
       </td>
  </tr>
</table>

-------------------------------------------------------------------------

empfangeURL.php

<title>Receiving</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?
   # get headers of response

    $url    = $_REQUEST;
    $scheme = 'http://';

    $_response = get_headers($scheme.$url, 1);

    echo "<pre>\r\n";
    echo htmlspecialchars(print_r($_response,1));
    echo "</pre>\r\n";
?>
--------------------------------------------------------------------------

 

echo htmlspecialchars(print_r($_response,1)); produce this output:

Array(    [0] => HTTP/1.0 301 Moved Permanently    [Server] => Array        (            [0] => Apache            [1] => Apache-Coyote/1.1            [2] => Apache-Coyote/1.1        )    [Location] => Array        (            [0] => http://www.ard.de/home/ard/ARD_Home/21920/index.html            [1] => /home/ard/ARD_Startseite/21920/index.html        )    [Content-Length] => Array        (            [0] => 322            [1] => 0        )    [Content-Type] => Array        (            [0] => text/html; charset=iso-8859-1            [1] => text/html            [2] => text/html;charset=UTF-8        )    [Date] => Array        (            [0] => Sun, 05 Jan 2014 20:52:16 GMT            [1] => Sun, 05 Jan 2014 20:52:17 GMT            [2] => Sun, 05 Jan 2014 20:52:18 GMT        )    [Connection] => Array        (            [0] => close            [1] => close            [2] => close        )    [1] => HTTP/1.0 301 Moved Permanently    [Content-Language] => Array        (            [0] => de-DE            [1] => de-DE        )    [Cache-Control] => Array        (            [0] => max-age=45            [1] => max-age=45        )    [2] => HTTP/1.0 200 OK)

Any ideas how to manipulate the output?

 

Best,

Richard

Link to comment
Share on other sites

Save the output into a log file or send it to a database into sapared columns.

 

Can you tell us all strory?   

 

Thanks,

 

I need to show the output/result in a website where you type the url. That's all. Maybe like this here: hxxp://elmar-eigner.de/_freetools/http-header-auslesen.php

I would like to solve the data issue with a external css file. It might be possible with the log file, which then sends the data in the new style back.But I think, it is maybe a bit too "roundabout". 

I thought that you might be able to embed the css style in the PHP print/echo function. For example, with class, div and so on.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.