| The Red Matrix

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Pages
Functions
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())
| z_post_url_json ($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)
| 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)
| discover_by_url ($url, $arr=null)
| discover_by_webbie ($webbie)
| webfinger_rfc7033 ($webbie)
| old_webfinger ($webbie)
| fetch_lrdd_template ($host)
| fetch_xrd_links ($url)
| scrape_vcard ($url)
| scrape_feed ($url)

## 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`
| ) |  |

Referenced by fetch_xrd_links().

discover_by_url | ( |  | $url,
|  |  | $arr = `null`
| ) |  |

Referenced by new_contact().

discover_by_webbie | ( |  | $webbie | ) |

Referenced by diaspora_mention_callback(), find_diaspora_person_by_handle(), import_author_diaspora(), and new_contact().

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

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

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

fetch_lrdd_template | ( |  | $host | ) |

Referenced by old_webfinger().

fetch_xrd_links | ( |  | $url | ) |

Referenced by fetch_lrdd_template(), and old_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(), diaspora_decode(), get_feed_for(), p_init(), poco_init(), and receive_post().

json_return_and_die | ( |  | $x | ) |

Referenced by api_albums(), api_channel_stream(), api_export_basic(), api_group(), api_group_members(), api_photos(), api_red_xchan(), chat_content(), chatsvc_content(), chatsvc_init(), chatsvc_post(), dirsearch_content(), impel_init(), new_channel_init(), notes_init(), oexchange_content(), online_init(), post_init(), post_post(), red_item_new(), register_init(), siteinfo_init(), smilies_content(), zfinger_init(), and zotfeed_init().

old_webfinger | ( |  | $webbie | ) |

Referenced by discover_by_webbie().

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

Referenced by diaspora_decode(), diaspora_dispatch(), fetch_xrd_links(), foofoo(), and get_diaspora_reshare_xml().

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

Referenced by diaspora2bb(), diaspora_asphoto(), diaspora_post(), diaspora_reshare(), and item_post().

scrape_feed | ( |  | $url | ) |

Referenced by discover_by_url().

scrape_vcard | ( |  | $url | ) |

Referenced by discover_by_webbie().

validate_email | ( |  | $addr | ) |

Referenced by check_account_email(), and zid_init().

validate_url | ( | & | $url | ) |

webfinger_rfc7033 | ( |  | $webbie | ) |

Referenced by discover_by_webbie().

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(), discover_by_url(), discover_by_webbie(), externals_run(), fetch_xrd_links(), get_diaspora_reshare_xml(), handle_feed(), import_post(), import_profile_photo(), import_site(), import_xchan(), navbar_complete(), oembed_fetch_url(), oexchange_content(), onepoll_run(), parseurl_getsiteinfo(), poco_load(), pubsites_content(), random_profile(), reflect_photo_callback(), remote_online_status(), scale_external_images(), scrape_feed(), scrape_vcard(), setup_post(), sslify_init(), sync_directories(), update_suggestions(), webfinger_rfc7033(), z_post_url(), zot_finger(), and zot_register_hub().

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

z_post_url

Parameters

  string | $url | URL to post
  mixed | $params | The full data to post in a HTTP "POST" operation. This parameter can either be passed as a urlencoded string like 'para1=val1&para2=val2&...' or as an array with the field name as key and field data as value. If value is an array, the Content-Type header will be set to multipart/form-data.
  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 deliver_run(), oexchange_content(), queue_run(), share_init(), z_post_url_json(), zot_finger(), zot_refresh(), and zot_zot().

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