https://github.com/code-rhapsodie/get-url-contents-ez-twig-bundle
https://github.com/code-rhapsodie/get-url-contents-ez-twig-bundle
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/code-rhapsodie/get-url-contents-ez-twig-bundle
- Owner: code-rhapsodie
- License: mit
- Created: 2020-08-26T13:11:27.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-10T14:45:59.000Z (almost 6 years ago)
- Last Synced: 2024-04-25T05:42:47.162Z (about 2 years ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Get Url Contents eZ Twig Bundle
This bundle adds:
- a `get_url_contents` Twig function
- a `get_url_contents` eZ Publish legacy template operator
Both share the same behaviour:
- perform a GET HTTP request to the URL passed as argument, using curl
- then, if the request succeeded and the response code is 200, return the response body as string
- otherwise, return an empty string
## Install
Just use Composer:
`composer require code-rhapsodie/get-url-contents-ez-twig-bundle`
## Usage
In Twig:
```twig
{{ get_url_contents('https://host/my_external_file.html') }}
```
In eZ Publish legacy templates:
```
{get_url_contents('https://host/my_external_file.html')}
```