# The Red Matrix: include/network.php File Reference

All Classes Namespaces Files Functions Variables Pages
network.php File Reference

## Functions

| get_capath ()
| z_fetch_url ($url, $binary=false, $redirects=0, $opts=array())
| z_post_url ($url, $params, $redirects=0, $opts=array())
| json_return_and_die ($x)
| xml_status ($st, $message= '')
| http_status_exit ($val, $msg= '')
| convert_xml_element_to_array ($xml_element, &$recursion_depth=0)
| webfinger_dfrn ($s, &$hcard)
| webfinger ($s, $debug=false)
| fetch_lrdd_template ($host)
| validate_url (&$url)
| validate_email ($addr)
| allowed_url ($url)
| allowed_email ($email)
| avatar_img ($email)
| parse_xml_string ($s, $strict=true)
| scale_external_images ($s, $include_link=true, $scale_replace=false)
| xml2array ($contents, $namespaces=true, $get_attributes=1, $priority= 'attribute')
| email_header_encode ($in_str, $charset= 'UTF-8')
| email_send ($addr, $subject, $headers, $item)

## Function Documentation

allowed_email | ( |  | $email | ) |

Referenced by check_account_email().

allowed_url | ( |  | $url | ) |

Referenced by new_contact().

avatar_img | ( |  | $email | ) |

convert_xml_element_to_array | ( |  | $xml_element,
|  | & | $recursion_depth = `0`
| ) |  |

email_header_encode | ( |  | $in_str,
|  |  | $charset = `'UTF-8'`
| ) |  |

Referenced by check_config(), lostpass_content(), lostpass_post(), and enotify\send().

email_send | ( |  | $addr,
|  |  | $subject,
|  |  | $headers,
|  |  | $item
| ) |  |

fetch_lrdd_template | ( |  | $host | ) |

Referenced by webfinger().

get_capath | ( |  | ) |

Referenced by z_fetch_url(), and z_post_url().

http_status_exit | ( |  | $val,
|  |  | $msg = `''`
| ) |  |

http_status_exit

Send HTTP status header and exit

Parameters

  int | $val | integer HTTP status result value
  string | $msg | optional message

Returns
  (does not return, process is terminated)

Referenced by _well_known_init(), cloud_init(), get_feed_for(), and poco_init().

json_return_and_die | ( |  | $x | ) |

Referenced by api_albums(), api_channel_stream(), api_export_basic(), api_photos(), chatsvc_content(), chatsvc_init(), chatsvc_post(), dirsearch_content(), new_channel_init(), notes_init(), oexchange_content(), online_init(), post_init(), post_post(), register_init(), zfinger_init(), and zotfeed_init().

parse_xml_string | ( |  | $s,
|  |  | $strict = `true`
| ) |  |

Referenced by consume_feed().

scale_external_images | ( |  | $s,
|  |  | $include_link = `true`,
|  |  | $scale_replace = `false`
| ) |  |

Referenced by diaspora2bb(), and item_post().

validate_email | ( |  | $addr | ) |

Referenced by check_account_email(), and zid_init().

validate_url | ( | & | $url | ) |

webfinger | ( |  | $s,
|  |  | $debug = `false`
| ) |  |

Referenced by webfinger_content(), and webfinger_dfrn().

webfinger_dfrn | ( |  | $s,
|  | & | $hcard
| ) |  |

xml2array | ( |  | $contents,
|  |  | $namespaces = `true`,
|  |  | $get_attributes = `1`,
|  |  | $priority = `'attribute'`
| ) |  |

xml2array() will convert the given XML text to an array in the XML structure. Link: http://www.bin-co.com/php/scripts/xml2array/ Portions significantly re-written by mike@.nosp@m.macg.nosp@m.irvin.nosp@m..com for Friendica (namespaces, lowercase tags, get_attribute default changed, more...) Arguments : $contents - The XML text $namespaces - true or false include namespace information in the returned array as array elements. $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the tag values - this results in a different array structure in the return value. $priority - Can be 'tag' or 'attribute'. This will change the way the resulting array sturcture. For 'tag', the tags are given more importance. Return: The parsed XML in an array form. Use print_r() to see the resulting array structure. Examples: $array = xml2array(file_get_contents('feed.xml')); $array = xml2array(file_get_contents('feed.xml', true, 1, 'attribute'));

xml_status | ( |  | $st,
|  |  | $message = `''`
| ) |  |

z_fetch_url | ( |  | $url,
|  |  | $binary = `false`,
|  |  | $redirects = `0`,
|  |  | $opts = `array()`
| ) |  |

z_fetch_url

Parameters

  string | $url | URL to fetch
  boolean | $binary | = false TRUE if asked to return binary results (file download)
  int | $redirects | = 0 internal use, recursion counter
  array | $opts | (optional parameters) 'accept_content' => supply Accept: header with 'accept_content' as the value 'timeout' => int seconds, default system config value or 60 seconds 'http_auth' => username:password 'novalidate' => do not validate SSL certs, default is to validate using our CA list

Returns
  array 'return_code' => HTTP return code or 0 if timeout or failure 'success' => boolean true (if HTTP 2xx result) or false 'header' => HTTP headers 'body' => fetched content

Referenced by check_htaccess(), directory_content(), dirprofile_init(), import_post(), import_profile_photo(), import_xchan(), navbar_complete(), oembed_fetch_url(), oexchange_content(), onepoll_run(), parseurl_getsiteinfo(), poco_load(), pubsites_content(), remote_online_status(), scale_external_images(), setup_post(), sslify_init(), sync_directories(), update_suggestions(), z_post_url(), zot_finger(), and zot_register_hub().

z_post_url | ( |  | $url,
|  |  | $params,
|  |  | $redirects = `0`,
|  |  | $opts = `array()`
| ) |  |

Referenced by oexchange_content(), share_init(), zot_finger(), zot_refresh(), and zot_zot().