title: Maximum execution time of 30 seconds exceeded only at second time
body: <p>I am dealing with a problem where answer from url(in my case it is JSON file) that I use 2nd time is taking a while, so php returns me  </p>
  
  <pre><code>Fatal error: Maximum execution time of 30 seconds exceeded in [myfile] on line 54
  </code></pre>
  
  <p>Here is some code:</p>
  
  <p><strong>save_road.php</strong></p>
  
  <pre><code>&lt;?php    
  include('simple_html_dom.php');
  include('controller.php');
  $restrictions = new road_restrictions; ?&gt;
  </code></pre>
  
  <p><strong>controller.php</strong></p>
  
  <pre><code>include('functions-map.php');
  
  class road_restrictions {
  
      function __construct() {
          $road_id = get_road_id();
          show($road_id);
          $informacion = $this-&gt;get_all_info($road_id);  //goes here
  
          foreach ($informacion as $info) {
              $this-&gt;save($info);
          }
  
          //show($informacion);
      }
  
      function get_all_info($road_id) {
  
          foreach ($road_id as $id) {
              $road_info = get_info($id);   //goes here
  
              if ($road_info !== NULL) {
                  $info[] = $road_info;
              }
          }
          return $info;
      }
  
      function save($info) {
          save_road($info);
      }
  }
  </code></pre>
  
  <p><strong>functions-map.php</strong></p>
  
  <pre><code>function get_info($id) {                
  $json = file_get_contents('http://restrictions.eismoinfo.lt/');  //stuck here
  $array = json_decode($json, true);
  //other code
  </code></pre>
  
  <p>It just takes too much time at this point of the code. First time when it is being called <strong>functions-map.php</strong> function <code>get_road_id()</code> (where is the same code to get json) it works just fine, but when it comes to <code>get_info</code> function <code>file_get_contents</code> it just waits for something till time ends.</p>
  
  <p>Do you have any suggestions?</p>