| 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 ()
| fetch_url ($url, $binary=false, &$redirects=0, $timeout=0, $accept_content=Null)
| post_url ($url, $params, $headers=null, &$redirects=0, $timeout=0)
| 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)
| lrdd ($uri, $debug=false)
| fetch_lrdd_template ($host)
| fetch_xrd_links ($url)
| validate_url (&$url)
| validate_email ($addr)
| allowed_url ($url)
| allowed_email ($email)
| avatar_img ($email)
| parse_xml_string ($s, $strict=true)
| add_fcontact ($arr, $update=false)
| scale_external_images ($s, $include_link=true, $scale_replace=false)
| fix_contact_ssl_policy (&$contact, $new_policy)
| xml2array ($contents, $namespaces=true, $get_attributes=1, $priority= 'attribute')
| email_header_encode ($in_str, $charset)
| email_send ($addr, $subject, $headers, $item)

## Function Documentation

add_fcontact | ( |  | $arr,
|  |  | $update = `false`
| ) |  |

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 lrdd().

email_header_encode | ( |  | $in_str,
|  |  | $charset
| ) |  |

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

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

fetch_lrdd_template | ( |  | $host | ) |

Referenced by webfinger().

fetch_url | ( |  | $url,
|  |  | $binary = `false`,
|  | & | $redirects = `0`,
|  |  | $timeout = `0`,
|  |  | $accept_content = `Null`
| ) |  |

fetch_url is deprecated and being replaced by the more capable z_fetch_url please use that function instead. Once all occurrences of fetch_url are removed from the codebase we will remove this function and perhaps rename z_fetch_url back to fetch_url

Referenced by dfrn_deliver(), dirfind_content(), fetch_xrd_links(), lrdd(), oembed_fetch_url(), post_url(), and scale_external_images().

fetch_xrd_links | ( |  | $url | ) |

Referenced by fetch_lrdd_template(), lrdd(), and webfinger().

fix_contact_ssl_policy | ( | & | $contact,
|  |  | $new_policy
| ) |  |

get_capath | ( |  | ) |

Referenced by fetch_url(), post_url(), 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(), get_feed_for(), and poco_init().

json_return_and_die | ( |  | $x | ) |

Referenced by api_albums(), api_channel_stream(), api_export_basic(), api_photos(), dirsearch_content(), new_channel_init(), post_post(), register_init(), zfinger_init(), and zotfeed_init().

lrdd | ( |  | $uri,
|  |  | $debug = `false`
| ) |  |

Referenced by handle_tag(), photos_post(), profiles_post(), and webfinger_content().

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

Referenced by consume_feed(), dfrn_deliver(), lrdd(), and notifications_content().

post_url | ( |  | $url,
|  |  | $params,
|  |  | $headers = `null`,
|  | & | $redirects = `0`,
|  |  | $timeout = `0`
| ) |  |

Referenced by dfrn_deliver(), and match_content().

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 lrdd(), 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'));

Referenced by fetch_xrd_links().

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(), import_post(), import_profile_photo(), navbar_complete(), oembed_fetch_url(), oexchange_content(), onepoll_run(), parseurl_getsiteinfo(), poco_load(), pubsites_content(), setup_post(), update_suggestions(), z_post_url(), zot_finger(), and zot_register_hub().

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

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