richard2014 Posted January 5, 2014 Share Posted January 5, 2014 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 Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted January 5, 2014 Share Posted January 5, 2014 Any ideas how to manipulate the output? Save the output into a log file or send it to a database into sapared columns. Can you tell us all strory? Quote Link to comment Share on other sites More sharing options...
richard2014 Posted January 5, 2014 Author Share Posted January 5, 2014 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. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted January 6, 2014 Share Posted January 6, 2014 http://www.php.net/manual/en/control-structures.foreach.php Quote Link to comment Share on other sites More sharing options...
richard2014 Posted January 6, 2014 Author Share Posted January 6, 2014 http://www.php.net/manual/en/control-structures.foreach.php Yea. That's what I meant. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.