Witam,

Muszę pilnie zoptymalizować kod PHP, z programowania back-end jestem totalną nogą więc może ktoś mógłby mi z tym pomóc? Mogę zapłacić.


Kod:

  1. <?php
  2. if (is_numeric($_GET['id'])) {
  3. $id= $_GET['id'];
  4. $sContent = file_get_contents('http://www...../content.php?id=' . $id);
  5. } else {
  6. $sContent = "error";
  7. }
  8. ?>
  9.  
  10.  
  11.  
  12. <title><?php
  13. foreach( explode("\n", $sContent) as $sLine )
  14. {
  15. if( strpos($sLine,"Subject: ") !== false )
  16. {
  17. echo str_replace("Subject: ","",$sLine);
  18. }
  19. }
  20. ?></title>
  21.  
  22.  
  23.  
  24.  
  25. <h1><?php
  26. foreach( explode("\n", $sContent) as $sLine )
  27. {
  28. if( strpos($sLine,"Subject: ") !== false )
  29. {
  30. echo str_replace("Subject: ","",$sLine);
  31. }
  32. }
  33. ?></h1>
  34.  
  35.  
  36. <?php
  37. $content = htmlspecialchars("$content");
  38. echo implode('<br>',explode("\n",htmlspecialchars(trim(strip_tags($sContent)))));
  39. ?>