I have two php pages. I want to fetch b.php in a.php.
In my a.php:
$ch = curl_init(\"b.php\");
echo(curl_exec($ch));
curl_close($ch);
cURL would primarily be used to retrieve data from external domains, therefore it wouldn't make too much sense to allow relative paths. The easiest thing to do would just be to append your current domain to the URL.
$domain = $_SERVER['HTTP_HOST'] . "/";
$ch = curl_init($domain . "b.php");
echo(curl_exec($ch));
curl_close($ch);