Beispiel #1
0
xmlDocPtr soap_xmlParseFile(const char *filename) {
  String cache_key("HPHP.SOAP.WSDL.");
  cache_key += filename;

  Variant content = f_apc_fetch(cache_key);
  if (same(content, false)) {
    Variant stream = File::Open(filename, "rb", 0, f_stream_context_create(
                CREATE_MAP1(s_http, CREATE_MAP1(s_timeout, 1000))));
    if (!same(stream, false)) {
      content = f_stream_get_contents(stream);
      if (!same(content, false)) {
        f_apc_store(cache_key, content);
      }
    }
  }

  if (!same(content, false)) {
    String scontent = content.toString();
    xmlDocPtr ret = soap_xmlParseMemory(scontent.data(), scontent.size(), false);
    if (ret) {
      ret->URL = xmlCharStrdup(filename);
    }
    return ret;
  }
  return NULL;
}
bool TestExtStream::test_stream_context_create() {
  f_stream_context_create();
  return Count(true);
}