Example Php
Try for free
No credit card required
Go to Store
Example Php
apify/example-php
Try for free
No credit card required
Example act using PHP as the main language.
Do you want to learn more about this Actor?
Get a demoThis is simple example how to use PHP in Apify. It uses custom Dockerfile based on php:7.0-cli
image.
Dockerfile
1FROM php:7.0-cli 2 3COPY ./* ./ 4 5CMD [ "php", "./main.php" ]
main.php
1<?php 2print "Starting ...\n"; 3print "ENV vars:\n"; 4print_r($_ENV); 5print "Fetching http://example.com ...\n"; 6$exampleComHtml = file_get_contents('http://example.com'); 7print "Searching for <h1> tag contents ...\n"; 8preg_match_all('/<h1>(.*?)<\/h1>/', $exampleComHtml, $matches); 9print "Found: " . $matches[1][0] . "\n"; 10print "I am done!\n";
Developer
Maintained by Apify
Actor Metrics
1 monthly user
-
3 stars
>99% runs succeeded
Created in Oct 2017
Modified 6 months ago
Categories