Now 129351 iCalcreator
users worldwide!!
Donate
You can show your appreciation for our free software
and can support future development by making a donation to the kigkonsult projects.
Make a donation of any size by clicking here. Thanks in advance!
Services
kigkonsult offer professional services for software support, design and new/re-development, customizations and adaptations
of PHP/MySQL solutions with focus on software lifecycle management, including long term utility, reliability and maintainability.
If you need any custom modules, modification or amendment based on iCalcreator
to suit your needs or professional support, don't hesitate to contact us.
iCalcreator used in.. .
- AgenDAV
- albaven
- All-in-One Event Calendar
- Bugscope
- Date iCal
- Dokeos
- event_connect
- ESS Feed
- Exponent CMS
- EQDKP Plus
- GCalendar
- GLPI
- Gumbo Millennium
- Hypecal
- iCal
- JCal Pro
- kitEvent
- luryevents
- MarkupiCalendar
- One Big SYSTem
- Open Atrium
- Repository based CMS
- sfiCalCreatorPlugin
- Telaen
- terncal
- twical
- Virtual Loup-De-Mer
- "Weather Forecast"
-
- And many more.. .
-
Tell us
what iCalcreator is missing,
use the contact page
Credits & Licenses
iCalcreator and the related PHP software was conceived and written by Kjell-Inge Gustafsson.
Many people have contributed, through providing questions, issues, reporting bugs and sending patches.
iCalcreator (standard) and the related PHP software are released under the
LGPL
/
GPL
/
CC
licences.
UrlRsrc
-
UrlRsrc - fetch an URL (file) resource content
- urlRsrc is a Curl wrapper and implements a (no-cache) http GET request.
- Output is a URL resource content string.
- Throws InvalidArgumentException/RuntimeException on error (also http code >= 400).
- No cookie or return headers managent, works out-of-the-box.
Click to get UrlRsrc
from github
- at packagist
|
USAGE
<?php
namespace Kigkonsult\Http;
include __DIR__ . '/vendor/autoload.php';
/**
* @param string $url the url (file) resource
* for missning scheme 'http' is used
* @param array $urlArgs opt, *( urlArgKey => value )
* if not empty, appended to url
* @param array $curlOpts opt, *( curlOptConstant => value )
* overwrites default (below) key value
* if key exists
* The keys should be valid curl_setopt()
* constants or their integer equivalents.
* @param int $sizeDownload hold (byte-)size of downloaded resource
* @param float $time hold operation exec time (in seconds)
* @return string
* @throws InvalidArgumentException
* @throws RuntimeException
*/
$content = UrlRsrc::getContent( 'example.com' );
Curl options
Default Curl options are
- CURLOPT_FAILONERROR => true,
- fail if HTTP return code >= 400
- CURLOPT_FOLLOWLOCATION => true,
- follow redirects
- CURLOPT_FRESH_CONNECT => true,
- use a NO-cached connection
- CURLOPT_USERAGENT => 'cURL',
- content of the "User-Agent: " header
- CURLOPT_HTTPHEADER => [ 'Accept: */*' ],
- array of HTTP headers, default Accept everything
- example : prefer html/xml but...
- 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
- CURLOPT_RETURNTRANSFER => true,
- get URL contents
- CURLOPT_CONNECTTIMEOUT => 60,
- max seconds to wait before connect timeout
- CURLOPT_TIMEOUT => 60,
- max seconds to wait before cUrl execute timeout
- CURLOPT_SSL_VERIFYHOST => 0,
- no check of common the names in the SSL peer certificate
-
- Note
- CURLOPT_SSL_VERIFYPEER is (auto-)set depending on URL scheme; https gives true else false
- UrlRsrc is indended to work without other added Curl options but
some URLs may require some
Opt certificate directives :
- CURLOPT_CAINFO => __DIR__ . '/cacert.pem'
- certificate file
- download up-to-date from http://curl.haxx.se/docs/caextract.html
- CURLOPT_CAPATH => 'fullPath/to/certs/dir'
- certificates directory
- How to implement (opt) basic authentication :
- CURLOPT_HTTPAUTH => CURLAUTH_BASIC
- CURLOPT_USERPWD => sprintf( '%s:%s', $userName, $password )
CurlOpts argument array key value overwrites default (above) if key is set.
More info about Curl options at php.net.