|
| get_capath () |
| Returns path to CA file. More...
|
|
| z_fetch_url ($url, $binary=false, $redirects=0, $opts=array()) |
| fetches an URL. More...
|
|
| z_post_url ($url, $params, $redirects=0, $opts=array()) |
| Does a curl post request. More...
|
|
| z_post_url_json ($url, $params, $redirects=0, $opts=array()) |
| Like z_post_url() but with an application/json HTTP header. More...
|
|
| json_return_and_die ($x, $content_type= 'application/json') |
|
| http_status ($val, $msg= '') |
| Send HTTP status header. More...
|
|
| http_status_exit ($val, $msg= '') |
| Send HTTP status header and exit. More...
|
|
| convert_xml_element_to_array ($xml_element, &$recursion_depth=0) |
| Convert an XML document to a normalised, case-corrected array used by webfinger. More...
|
|
| z_dns_check ($h, $check_mx=0) |
|
| validate_url (&$url) |
| Validates a given URL. More...
|
|
| validate_email ($addr) |
| Checks that email is an actual resolvable internet address. More...
|
|
| allowed_url ($url) |
| Check $url against our list of allowed sites. More...
|
|
| allowed_email ($email) |
| Check if email address is allowed to register here. More...
|
|
| parse_xml_string ($s, $strict=true) |
|
| scale_external_images ($s, $include_link=true, $scale_replace=false) |
| Scales an external image. More...
|
|
| xml2array ($contents, $namespaces=true, $get_attributes=1, $priority= 'attribute') |
| xml2array() will convert the given XML text to an array in the XML structure. More...
|
|
| email_header_encode ($in_str, $charset= 'UTF-8') |
|
| discover_by_url ($url, $arr=null) |
| Creates an xchan entry for URL. More...
|
|
| discover_by_webbie ($webbie, $protocol= '') |
|
| webfinger_rfc7033 ($webbie, $zot=false) |
| Fetch and return a webfinger for a webbie. More...
|
|
| old_webfinger ($webbie) |
|
| fetch_lrdd_template ($host) |
|
| fetch_xrd_links ($url) |
|
| scrape_feed ($url) |
|
| do_delivery ($deliveries, $force=false) |
|
| get_site_info () |
|
| check_siteallowed ($url) |
|
| check_channelallowed ($hash) |
|
| deliverable_singleton ($channel_id, $xchan) |
|
| get_repository_version ($branch= 'master') |
|
| network_to_name ($s) |
| Get translated network name. More...
|
|
| z_mail ($params) |
| Send a text email message. More...
|
|
| probe_api_path ($host) |
| Discover the best API path available for redmatrix/hubzilla servers. More...
|
|
| scrape_vcard ($url) |
|
| service_plink ($contact, $guid) |
|
| getBestSupportedMimeType ($mimeTypes=null, $acceptedTypes=false) |
|
| jsonld_document_loader ($url) |
| Perform caching for jsonld normaliser. More...
|
|
Network related functions.
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...)
Examples: $array = xml2array(file_get_contents('feed.xml')); $array = xml2array(file_get_contents('feed.xml', true, 1, 'attribute'));
- Parameters
-
string | $contents | The XML text |
boolean | $namespaces | true or false include namespace information in the returned array as array elements |
int | $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. |
string | $priority | Can be 'tag' or 'attribute'. This will change the way the resulting array sturcture. For 'tag', the tags are given more importance. |
- Returns
- array The parsed XML in an array form. Use print_r() to see the resulting array structure.
z_fetch_url |
( |
|
$url, |
|
|
|
$binary = false , |
|
|
|
$redirects = 0 , |
|
|
|
$opts = array() |
|
) |
| |
fetches an URL.
- Parameters
-
string | $url | URL to fetch |
boolean | $binary | default false TRUE if asked to return binary results (file download) |
int | $redirects | default 0 internal use, recursion counter |
array | $opts | (optional parameters) associative array with:
- timeout => int seconds, default system config value or 60 seconds
- headers => array of additional header fields
- http_auth => username:password
- novalidate => do not validate SSL certs, default is to validate using our CA list
- nobody => only return the header
- filep => stream resource to write body to. header and body are not returned when using this option.
- custom => custom request method: e.g. 'PUT', 'DELETE'
- cookiejar => cookie file (write)
- cookiefile => cookie file (read)
- session => boolean; append session cookie if $url is our own site
|
- Returns
- array an associative array with:
- int return_code => HTTP return code or 0 if timeout or failure
- boolean success => boolean true (if HTTP 2xx result) or false
- string header => HTTP headers
- string body => fetched content
Referenced by Zotlabs\Module\Setup\check_htaccess(), Zotlabs\Storage\CalDAVClient\ctag_fetch(), Zotlabs\Storage\CalDAVClient\detail_fetch(), discover_by_url(), discover_by_webbie(), Zotlabs\Lib\SuperCurl\exec(), feed_conversation_fetch(), Zotlabs\Lib\ActivityStreams\fetch_property(), fetch_xrd_links(), Zotlabs\Module\Pubsites\get(), Zotlabs\Module\Linkinfo\get(), Zotlabs\Module\Oexchange\get(), Zotlabs\Module\Rpost\get(), Zotlabs\Module\Directory\get(), Zotlabs\Module\Connedit\get(), get_repository_version(), handle_feed(), Zotlabs\Module\Import\import_account(), import_channel_photo_from_url(), import_site(), import_xchan(), import_xchan_photo(), Zotlabs\Module\Sslify\init(), Zotlabs\Module\Magic\init(), Zotlabs\Module\Ratings\init(), Zotlabs\Module\Acl\navbar_complete(), oembed_fetch_url(), Zotlabs\Module\Linkinfo\parseurl_getsiteinfo(), poco_load(), Zotlabs\Module\Import_items\post(), Zotlabs\Module\Setup\post(), probe_api_path(), random_profile(), reflect_photo_callback(), remote_online_status(), Zotlabs\Daemon\Cron_weekly\run(), Zotlabs\Daemon\Onepoll\run(), Zotlabs\Daemon\Ratenotif\run(), Zotlabs\Daemon\Externals\run(), Zotlabs\Zot\Finger\run(), scale_external_images(), scrape_feed(), scrape_vcard(), sync_directories(), update_suggestions(), webfinger_rfc7033(), z_check_cert(), z_post_url(), and zot_register_hub().
z_post_url |
( |
|
$url, |
|
|
|
$params, |
|
|
|
$redirects = 0 , |
|
|
|
$opts = array() |
|
) |
| |
Does a curl post request.
- 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¶2=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) '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 'filep' => stream resource to write body to. header and body are not returned when using this option. 'custom' => custom request method: e.g. 'PUT', 'DELETE' |
- Returns
- array an associative array with:
- int return_code => HTTP return code or 0 if timeout or failure
- boolean success => boolean true (if HTTP 2xx result) or false
- string header => HTTP headers
- string body => content
- string debug => from curl_info()
Referenced by Zotlabs\Module\Oexchange\get(), Zotlabs\Module\Share\init(), queue_deliver(), Zotlabs\Zot\Finger\run(), sync_files(), z_post_url_json(), zot_refresh(), and zot_zot().