api curl function - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of api curl function.php
- <?php
- function gettr($url) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- $data = curl_exec($ch);
- curl_close($ch);
- return $data;
- }
- $urlok= 'https://www.xxxxxxx.com/api/changeNameServers?version=1&type=xml&key='.$keyy.'&domain='.$domxxx.'&ns1='.$ns1.'&ns2='.$ns2;
- $vprice= gettr($urlok);