VOOZH about

URL: https://apify.com/apify/example-php

⇱ Example Php · Apify


Pricing

Pay per usage

Go to Apify Store

Example Php

Example act using PHP as the main language.

Pricing

Pay per usage

Rating

4.7

(4)

Developer

👁 Apify

Apify

Maintained by Apify

Actor stats

3

Bookmarked

59

Total users

0

Monthly active users

7 months ago

Last modified

Share

This is simple example how to use PHP in Apify. It uses custom Dockerfile based on php:7.0-cli image.

Dockerfile

FROM php:7.0-cli
COPY ./* ./
CMD [ "php", "./main.php" ]

main.php

<?php
print "Starting ...\n";
print "ENV vars:\n";
print_r($_ENV);
print "Fetching http://example.com ...\n";
$exampleComHtml = file_get_contents('http://example.com');
print "Searching for <h1> tag contents ...\n";
preg_match_all('/<h1>(.*?)<\/h1>/', $exampleComHtml, $matches);
print "Found: " . $matches[1][0] . "\n";
print "I am done!\n";

You might also like

Actor in Go example

jirimoravcik/go-actor-example

Example actor written in Go.

👁 User avatar

Jiří Moravčík

16

Ruby Example

drobnikj/ruby-example

Example of ruby code in actor

👁 User avatar

Jakub Drobník

14

Packagist PHP Packages Scraper

parseforge/packagist-php-packages-scraper

Scrape PHP package metadata from Packagist public API. Get package name, vendor, description, latest version, downloads, dependencies, repository, license. No API key required.

2

Actor in Rust Example

lukaskrivka/rust-actor-example

Example actor built in Rust programming language. Downloads HTML from any page. Works on Apify platform and locally.

👁 User avatar

Lukáš Křivka

14

Example Selenium

apify/example-selenium

Example of loading a web page in headless Chrome using Selenium Webdriver.

296

5.0

Actor in Julia example

jirimoravcik/julia-actor-example

Example actor written in Julia.

👁 User avatar

Jiří Moravčík

4

Example using GitHub Gist

apify/example-github-gist

Example of an Apify actor with source code hosted in a GitHub Gist. For example, this is useful if you want to have public code examples accompanied by a working API that anyone can try straight away.

Related articles

How to send a GET request with cURL: step-by-step guide
Read more