本文整理汇总了PHP中Ak::url_get_contents方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::url_get_contents方法的具体用法?PHP Ak::url_get_contents怎么用?PHP Ak::url_get_contents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::url_get_contents方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_should_keep_cookies
public function test_should_keep_cookies()
{
$this->assertEqual(Ak::url_get_contents($this->url . '/persisting_cookies', array('cookies' => false)), 1);
$this->assertEqual(Ak::url_get_contents($this->url . '/persisting_cookies', array('cookies' => true)), 1);
$this->assertEqual(Ak::url_get_contents($this->url . '/persisting_cookies', array('cookies' => true)), 2);
$this->assertEqual(Ak::url_get_contents($this->url . '/persisting_cookies', array('cookies' => true)), 3);
$this->assertEqual(Ak::url_get_contents($this->url . '/persisting_cookies'), 1);
$this->assertEqual(Ak::url_get_contents($this->url . '/persisting_cookies', array('cookies' => false)), 1);
$this->assertEqual(Ak::url_get_contents($this->url . '/persisting_cookies', array('cookies' => true)), 1);
}
示例2: test_get_extra_resources
public function test_get_extra_resources()
{
$this->photo_path = AK_TEST_DIR . DS . 'fixtures' . DS . 'public' . DS . 'images' . DS . 'cristobal.jpg';
$this->watermark = AK_TEST_DIR . DS . 'fixtures' . DS . 'public' . DS . 'images' . DS . 'watermark.png';
if (!is_file($this->photo_path)) {
Ak::file_put_contents($this->photo_path, Ak::url_get_contents('http://www.akelos.org/testing_resources/images/cristobal.jpg'));
Ak::file_put_contents($this->watermark, Ak::url_get_contents('http://www.akelos.org/testing_resources/images/watermark.png'));
}
$this->_run_extra_tests = is_file($this->photo_path);
}
示例3: __construct
public function __construct()
{
parent::__construct();
$this->fixtures_base = AkConfig::getDir('fixtures') . DS . 'Image_TestCase';
if (!($this->offline_mode = !@file_get_contents('http://www.akelos.org/testing_resources/images/watermark.png'))) {
$this->image_path = $this->fixtures_base . DS . 'akelos_framework_logo.png';
$this->photo_path = $this->fixtures_base . DS . 'cristobal.jpg';
$this->watermark = $this->fixtures_base . DS . 'watermark.png';
AkFileSystem::copy(AkConfig::getDir('fixtures') . '/old_logo.png', $this->image_path, array('base_path' => AK_FRAMEWORK_DIR));
$cristobal = @Ak::url_get_contents('http://www.akelos.org/testing_resources/images/cristobal.jpg', array('cache' => 100000));
if (!empty($cristobal)) {
AkFileSystem::file_put_contents($this->photo_path, $cristobal, array('base_path' => AK_FRAMEWORK_DIR));
}
$watermark = @Ak::url_get_contents('http://www.akelos.org/testing_resources/images/watermark.png', array('cache' => 100000));
if (!empty($watermark)) {
AkFileSystem::file_put_contents($this->watermark, $watermark, array('base_path' => AK_FRAMEWORK_DIR));
}
$this->_run_extra_tests = file_exists($this->photo_path);
}
}
示例4: should_accept_redirects
function should_accept_redirects()
{
$this->assertEqual(Ak::url_get_contents($this->url . '/redirect_1'), 3);
}
示例5: _getImagePath
function _getImagePath($path)
{
if(preg_match('/^http(s)?:\/\//', $path)){
$path_info = pathinfo($path);
$base_file_name = Ak::sanitize_include($path_info['basename'], 'paranaoid');
if(empty($path_info['extension'])){ // no extension, we don't do magic stuff
$path = '';
}else{
$local_path = AK_TMP_DIR.DS.'mailer'.DS.'remote_images'.DS.md5($base_file_name['dirname']).DS.$base_file_name.'.'.$path_info['extension'];
if(!file_exists($local_path) || (time() > @filemtime($local_path)+7200)){
if(!Ak::file_put_contents($local_path, Ak::url_get_contents($path))){
return '';
}
}
return $local_path;
}
}
$path = AK_PUBLIC_DIR.Ak::sanitize_include($path);
if(!file_exists($path)){
$path = '';
}
return $path;
}
示例6: _getImagePath
protected function _getImagePath($path)
{
$tmp_dir = AkConfig::getDir('tmp');
if (preg_match('/^http(s)?:\\/\\//', $path)) {
$path_info = pathinfo($path);
$base_file_name = Ak::sanitize_include($path_info['basename'], 'paranaoid');
if (empty($path_info['extension'])) {
// no extension, we don't do magic stuff
$path = '';
} else {
$local_path = $tmp_dir . DS . 'mailer' . DS . 'remote_images' . DS . md5($path) . DS . $base_file_name . '.' . $path_info['extension'];
if (!file_exists($local_path) || time() > filemtime($local_path) + 7200) {
if (!AkFileSystem::file_put_contents($local_path, Ak::url_get_contents($path), array('base_path' => $tmp_dir))) {
return '';
}
}
if (!file_exists($local_path) || filesize($local_path) < 1) {
return '';
}
return $local_path;
}
}
$org_path = $path;
$public_dir = AkConfig::getDir('public');
$path = $public_dir . $path;
$path = realpath($path);
if (substr($path, 0, strlen($public_dir)) != $public_dir || !file_exists($path)) {
$path = '';
}
return $path;
}
示例7: _performRequest
function _performRequest($method, $options)
{
$this->_mapOptionAliases($options);
$this->_ensuredRequiredOptionsAreSet($options);
return Ak::url_get_contents("http://$this->_api_key.rest.akismet.com/1.1/$method",
array('method'=>'POST', 'params' => $options));
}
示例8: get_twitter_feeds
public function get_twitter_feeds($screen_name = 'akelos')
{
return json_decode(@Ak::url_get_contents('http://twitter.com/statuses/user_timeline/' . $screen_name . '.json?count=4', array('cache' => 240)));
}
示例9: _updateUsingHttp
private function _updateUsingHttp($name, $uri)
{
if (is_file(AK_PLUGINS_DIR . DS . $name . DS . 'CHANGELOG') && md5(Ak::url_get_contents(rtrim($uri, '/') . '/' . $name . '/CHANGELOG')) == md5_file(AK_PLUGINS_DIR . DS . $name . DS . 'CHANGELOG')) {
return false;
}
$this->_copyRemoteDir(rtrim($uri, '/') . '/' . $name . '/', AK_PLUGINS_DIR);
}
示例10: die
if (empty($options['parameters'])) {
die("You must supply at least one plugin name or plugin URL to uninstall.\n");
}
$plugins = Ak::toArray($options['parameters']);
foreach ($plugins as $plugin) {
$plugin_name = basename($plugin);
echo "\nUninstalling {$plugin}\n";
$PluginManager->uninstallPlugin($plugin_name);
}
echo "Done.\n";
die;
}
/**
* Shows plugin info at plugin_path/ABOUT.
*/
if ($command == 'info') {
$options = get_console_options_for('Remove plugins.', array(CONSOLE_GETARGS_PARAMS => array('short' => 'p', 'desc' => "Plugin names as given in 'plugin list' output or absolute URL to a plugin repository.", 'max' => 1, 'min' => 1)));
if (empty($options['parameters'])) {
die("You must supply a plugins name or plugin URL.\n");
}
$plugin = $options['parameters'];
$plugin_name = basename($plugin);
if ($plugin_name != $plugin) {
$repository = preg_replace('/\\/?' . $plugin_name . '$/', '', trim($plugin));
} else {
$repository = $PluginManager->getRepositoryForPlugin($plugin_name);
}
$about = Ak::url_get_contents(rtrim($repository, '/') . '/' . $plugin_name . '/ABOUT', array('timeout' => 10));
echo empty($about) ? "Could not get plugin information." : $about;
die("\n");
}
示例11: _getImagePath
public function _getImagePath($path)
{
if (preg_match('/^http(s)?:\\/\\//', $path)) {
$path_info = pathinfo($path);
$base_file_name = Ak::sanitize_include($path_info['basename'], 'paranaoid');
if (empty($path_info['extension'])) {
// no extension, we don't do magic stuff
$path = '';
} else {
$local_path = AK_TMP_DIR . DS . 'mailer' . DS . 'remote_images' . DS . md5($path) . DS . $base_file_name . '.' . $path_info['extension'];
if (!file_exists($local_path) || time() > @filemtime($local_path) + 7200) {
if (!Ak::file_put_contents($local_path, Ak::url_get_contents($path))) {
return '';
}
}
if (@filesize($local_path) < 1) {
return '';
}
return $local_path;
}
}
$org_path = $path;
$path = AK_PUBLIC_DIR . $path;
$path = realpath($path);
if (substr($path, 0, strlen(AK_PUBLIC_DIR)) != AK_PUBLIC_DIR || !file_exists($path)) {
$path = '';
}
return $path;
}
示例12: __destruct
public function __destruct()
{
if ($this->webserver_enabled) {
Ak::url_get_contents($this->_test_script . '?destruct=1');
}
}
示例13: _verifyFontExistence
function _verifyFontExistence($font)
{
$font_name = str_replace('/fonts/', '', $font);
if (!file_exists(AK_PUBLIC_DIR . DS . $font) && !file_exists(AK_PUBLIC_DIR . DS . $font . '.error.txt')) {
$remote_font = @Ak::url_get_contents('http://svn.akelos.org/extras/fonts/sifr/' . $font_name, array('timeout' => 30));
if (empty($remote_font)) {
Ak::file_put_contents(AK_PUBLIC_DIR . DS . $font . '.error.txt', 'Could not download ' . 'http://svn.akelos.org/extras/sifr_fonts/' . $font_name);
} else {
Ak::file_put_contents(AK_PUBLIC_DIR . DS . $font, $remote_font);
}
}
}