You are here:  » could not open XML file


could not open XML file

Submitted by fudog on Wed, 2010-01-06 03:53 in

Hello Support Team,

I would ask some help, Im still new to MagicParser but its seems that its easy to understand how to make it work.
I have an XML link and I need to get the contents.
This is the URL http://tourneys.absolutepoker.com:8055/TourSchedule.xml.

I have tried it on my localhost and it worked great. But when I uploaded and run it online it displays this error.
"could not open http://tourneys.absolutepoker.com:8055/TourSchedule.xml". Please let me know what I need to add to my code to make it work.

Thanks you.

Francis

Submitted by support on Wed, 2010-01-06 10:21

Hello Francis,

The most likely scenario here i'm afraid is that your web server is behind a firewall that is preventing outgoing TCP/IP connections on port 8055 (that is what the :8055 refers to in your URL).

However, before contacting your host to ask if it would be possible to permit your server to have outbound access on that port, it would be worth confirming this with a test script; using a couple of different methods to access the remote URL.

If you could run this script and let me know what output is displayed, that will help me to identify the problem and, if necessary, what to ask your host:

test.php

<?php
  header
("Content-Type: text/plain");
  
$urlA "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml";
  
$urlB "http://tourneys.absolutepoker.com:8055/TourSchedule.xml";
  
$urlC "http://tourneys.absolutepoker.com/TourSchedule.xml";
  print 
"Testing urlA with fopen()...";
  
$xml file_get_contents($urlA);
  print 
strlen($xml)." bytes received.\n";
  print 
"Testing urlA with CURL......";
  
$ch curl_init($urlA);
  
curl_setopt($chCURLOPT_HEADER0);
  
curl_setopt($chCURLOPT_RETURNTRANSFER1);
  
$xml curl_exec($ch);
  print 
strlen($xml)." bytes received.\n";
  print 
"Testing urlB with fopen()...";
  
$xml file_get_contents($urlB);
  print 
strlen($xml)." bytes received.\n";
  print 
"Testing urlC with CURL......";
  
$ch curl_init($urlA);
  
curl_setopt($chCURLOPT_HEADER0);
  
curl_setopt($chCURLOPT_RETURNTRANSFER1);
  
curl_setopt($chCURLOPT_PORT8055);
  
$xml curl_exec($ch);
  print 
strlen($xml)." bytes received.\n";
?>

Thanks,
David.
--
MagicParser.com

Submitted by fudog on Wed, 2010-01-06 12:45

Hello David,

Thank you for your quick reply. Here is the output of the script that you gave.

Testing urlA with fopen()...22398 bytes received.
Testing urlA with CURL......21905 bytes received.
Testing urlB with fopen()...0 bytes received.
Testing urlC with CURL......0 bytes received.

It seems that my URL are not responding,
please let me know whats your assessment regarding my concern.

Regards,

Francis

Submitted by support on Wed, 2010-01-06 13:02

Hello Francis,

(please note that when you post it does not appear immediately - I always check posts before the appear to protect customers details / URLs etc.)

I'm sorry - I missed one of the tests out of that script (urlB with CURL) and also the test for urlC was incorrect - please could you try this version:

<?php
  header
("Content-Type: text/plain");
  
$urlA "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml";
  
$urlB "http://tourneys.absolutepoker.com:8055/TourSchedule.xml";
  
$urlC "http://tourneys.absolutepoker.com/TourSchedule.xml";
  print 
"Testing urlA with fopen()...";
  
$xml file_get_contents($urlA);
  print 
strlen($xml)." bytes received.\n";
  print 
"Testing urlA with CURL......";
  
$ch curl_init($urlA);
  
curl_setopt($chCURLOPT_HEADER0);
  
curl_setopt($chCURLOPT_RETURNTRANSFER1);
  
$xml curl_exec($ch);
  print 
strlen($xml)." bytes received.\n";
  print 
"Testing urlB with fopen()...";
  
$xml file_get_contents($urlB);
  print 
strlen($xml)." bytes received.\n";
  print 
"Testing urlB with CURL......";
  
$ch curl_init($urlB);
  
curl_setopt($chCURLOPT_HEADER0);
  
curl_setopt($chCURLOPT_RETURNTRANSFER1);
  
$xml curl_exec($ch);
  print 
strlen($xml)." bytes received.\n";
  print 
"Testing urlC with CURL......";
  
$ch curl_init($urlC);
  
curl_setopt($chCURLOPT_HEADER0);
  
curl_setopt($chCURLOPT_RETURNTRANSFER1);
  
curl_setopt($chCURLOPT_PORT8055);
  
$xml curl_exec($ch);
  print 
strlen($xml)." bytes received.\n";
?>

Now, if that says:

Testing urlB with CURL......0 bytes received.
Testing urlC with CURL......0 bytes received.

Then it does mean that your server is blocked from making outbound HTTP connections on port 8055. Here is what you would need to ask your host:

"I would like to run a PHP script on my account that uses fopen() to access an HTTP URL that is on a non-standard port. I am able to access normal URLs that use port 80, but the URL I want to use requires a connection on port 8055. I assume that my server / hosting account is blocked by a firewall from making an external connection on this port, and if this is the case, would it be possible to allow my account to have external access on this port?"

Hope this helps,
Cheers,
David.

Submitted by fudog on Wed, 2010-01-06 13:18

Hello David,

Thank you for the reply. I will contact my hosting immediately today.
Regard,

Francis