Ich habe hier eine Applikation die ich per Xampp auf einem Windows Rechner laufen habe.
Ich wollte Lokal eine custom url haben. Angepasst in windows host file und xampp httpd-vhosts.conf.
Die Applikation läuft
Wenn ich aber verusche, ein curl call zu machen, kommt die Fehlermeldung Could not resolve host: test.localhost
gebe ich die Url in den Browser ein, erfolgt der Call
Meine Applikation: test.localhost
Der Call: test.localhost/api_call
httpd-vhosts.conf
- Code: Select all
<VirtualHost *>
# Pfad muss angepasst werden
DocumentRoot C:\xampp\htdocs/sites
ServerName localhost
</VirtualHost>
<VirtualHost *>
# Pfad verweist auf Projekt-Ordner
DocumentRoot "C:\xampp\htdocs/sites/test"
ServerName test.localhost
DirectoryIndex index.php
<Directory "C:\xampp\htdocs/sites/test">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
hier der CAll den ich versuche
- Code: Select all
$url = 'test.localhost/api_call';
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
// curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
weiss jemand was das Problem ist?