Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

950
Views
PHP: file_get_contents(): failed to open stream error - works on test XAMPP test server, not live

I’m creating a PHP application that for a movie theater that, when accessed by a user, fetches an external XML document, saves it to our server. That XML file is then used to load the showtimes and other movie information. If the file on our server is older than 15 minutes, it’ll be overwritten, otherwise, it’ll load the existing one. I already pretty much finished the application, and it works perfect on my XAMPP test server, however it fails to work on the live server.

The external XML file is located at this URL: http://45502.formovietickets.com:2235/showtimes.xml. Our server that I am trying to save the file to is on one of HostGator’s Linux-based servers. Using PHP’s curl functions, I have been able to successfully load the XML file on the XAMPP test server only. On the live server, it simply fails to connect.

I feel like it might be an some sort of access restriction on the formovietickets.com server, but the people behind it insist there isn't any sort of restriction going on. Does anyone know a work around for this issue?

<?php

$url = 'http://45502.formovietickets.com:2235/showtimes.xml';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if(curl_exec($ch) === false) {
    echo 'Curl error: '.curl_error($ch);
} else {
    echo 'Retrieved file with no errors!';
}
curl_close($ch);

?>

What Have I Tested?

  • I’ve tried transferring the php.ini file over from XAMPP to the live server and it still fails.
  • I was able to successfully retrieve an XML file located on another external server.
  • I’ve tested the code on a Windows-based server and the problem persists.

NOTE: If you load the URL more than a couple times from the same IP address in less than 15 minutes, you’ll get an error saying “Too many requests from this IP address”. Just saying in case you try testing it out.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

My guess is that your hoster is blocking outbound access to non-standard ports like 2235 in their firewall. If that is the case, you should ask them to open that port and hope that they are willing to do so. If they aren't, then you'll have to come up with another solution to get the file on the server, like using a proxy or pushing the file to the server instead of fetching it.

over 4 years ago · Santiago Trujillo Report

0

Did you check the /etc/hosts file, on Windows it's at C:\Windows\System32\Drivers\etc\hosts, it might be causing formovietickets.com to resolve to a different IP, and it takes priority over the DNS server, speaking of which, try changing your DNS server.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!