Help - Search - Members - Calendar
Full Version: Using Fopen Or File_get_contents In Dynamic Mode
Movable Type Community Forum > Additional Resources > Tips and Tricks
newcomer
Hi, smile.gif

I used some php code in my weblog that built dynamically. It occasionally happened that some functions like "fopen" or "file_get_contents" could not connect to the host of a file. Therefore, it failed and the Dynamic Page Error loaded.
CODE
file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known.

Even though I put them to an if-else condition, but my pages only load to the line that the condition stands. After it the Dynamic Page Error loaded and I have an error page within entry page.

Is there any way for resolving this problem?
newcomer
I could not explain my problem understandable or there is not any answer for it that anyone did not suggest anything? smile.gif

I try myself every thing that I knew, but without any result.
DaveVT5
I think I understand what you are asking. I ran into a similar problem when trying to use simpleXML (PHP function) to load an XML file in a dynamic template.

CODE
$relatedURL = "/editorials/web_portals/index.xml";
$related = simplexml_load_file($relatedURL);
echo "from xml: ". $related->channel->description;


Where $relatedURL is a "Category Archive Template" that exports the last 4 entries in XML format.

When I try to load the XML file (2nd line of code above) I get the following error:

QUOTE
I/O warning : failed to load external entity "/editorials/web_portals/index.xml"


From what I gather this has to do with the fact that the Smarty page is a cached template (located in /template_c). I'm not sure why it won't work but it doesn't.

So I guess that is a long way of saying 'no' I can't really answer your question. But maybe something I wrote helps?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.