⊗ppSpAiPp 40 of 83 menu

Preparation for Studying API in PHP

When working with an API, there is always a site that provides this API and sites that use this API.

Let's create two test sites on localhost: the site api.loc, which serves the API, and the site tst.loc, which accesses this API.

Let's test the joint work of these sites. Let the API site on the main page return some text:

<?php echo 'test'; ?>

Let's access this address from the test site and get the result:

<?php $url = 'http://api.loc/index.php'; $res = file_get_contents($url); var_dump($res); ?>

Create the two described sites and check their operation.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline