Yes. This is exactly why CURLOPT_REFERER exist: to customize the referer header.
See
hans@LAPTOP-O1AO16UE:~$ cat wut.php
<?php
$ch = curl_init();
curl_setopt_array($ch,array(
CURLOPT_URL=>'http://example.com',
CURLOPT_REFERER=>'http://google.com/',
CURLOPT_VERBOSE=>1
));
curl_exec($ch);
hans@LAPTOP-O1AO16UE:~$ php wut.php
* Host example.com:80 was resolved.
* IPv6: 2600:1406:bc00:53::b81e:94ce, 2600:1406:bc00:53::b81e:94c8, 2600:1406:3a00:21::173e:2e66, 2600:1406:3a00:21::173e:2e65, 2600:1408:ec00:36::1736:7f24, 2600:1408:ec00:36::1736:7f31
* IPv4: 23.192.228.84, 96.7.128.198, 23.215.0.138, 23.215.0.136, 23.192.228.80, 96.7.128.175
* Trying 23.192.228.84:80...
* Connected to example.com (23.192.228.84) port 80
> GET / HTTP/1.1
Host: example.com
Accept: */*
Referer: http://google.com/
< HTTP/1.1 200 OK
< Content-Type: text/html
(...)
The keyword here is Referer: http://google.com/
stackoverflow.com
will see onlyGoogle.com
. it can't see my website?