PHPで WEBサイトを取得するには昔は「cURL」や「file_get_contents」 をしていましたが、GUZZLEを使いましょう。
https://packagist.org/packages/guzzlehttp/guzzle
composer require guzzlehttp/guzzle
$url = 'https://YOUR-WEB-SITE/';
$client = new \GuzzleHttp\Client();
$res = $client->request('GET', $url, [
'verify' => false ,
'headers' => [
'User-Agent' => 'YOUR-USER-AGENT',
] ,
]);
$html = $res->getBody()->getContents();
echo $html;
$url = 'https://YOUR-WEB-SITE/';
$client = new \GuzzleHttp\Client(
[\GuzzleHttp\RequestOptions::VERIFY => false]
);
$client->request('POST', $url, [
'form_params' => [
'foo' => 'bar',
'hogehoge' => ['hoge1', 'hoge2']
]
]);