By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,196 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

url in php cl

P: 2
I m having a problem while doing an xmlreader open in php cl. The script runs perfectly on webservers.

My problem is while opening an xml flow, the url I request contains & characters and replace them with & .

I understood from my research that a html encoding is done... is there a workaround to kick away this encoding? I tried locally in my environement and it worked fine... no html encoding is performed...

fyi here is the error I m getting, I m 100% sure the flow is good

Expand|Select|Wrap|Line Numbers
  1. <b>Warning</b>:  XMLReader::open(http://flux.myflow.com/catalogue.php?maff=546C4EB1B171&amp;type=xml&amp;ordre=&amp;noms=) [<a href='xmlreader.open'>xmlreader.open</a>]: failed to open stream: Network is unreachable in <b>/www/split-reader.php</b> on line <b>61</b><br />
May 29 '10 #1
Share this Question
Share on Google+
2 Replies


Atli
Expert 5K+
P: 5,058
Do you change the & to &amp; or is PHP doing that for you?
If it's not you, PHP could just be HTML encoding it for the error message. Try disabling the html_errors directive.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. ini_set('html_errors', false);
  3.  
  4. // rest of the code...
  5.  
Also, your error message says: "Network is unreachable". This strikes me as odd if the ampersand encoding is really the problem. They are only in the query-string, not the actual network address, so it shouldn't affect it. At worst, this should give you a 404 error.

Perhaps the CLI is being blocked from reaching the internet by a firewall? When run in a web server, PHP would actually be a process within the web server itself, so it should not face this same problem.

Try running any other function meant to fetch data from the outside and see if it gives you the same problem.
May 30 '10 #2

P: 2
Hey... thanks for you answer... I think you totally got it, I was too focused on the & problem... The host is actually blocking external access via ssh :-/ ie I tried a curl and it was blocked....

My workaround will be to download flows first via web server and then work with the ssh.... the overall goal is to update the site by getting the flow...
May 30 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.