php - Can I let fsockopen go through a proxy without awareness?

one text

The php code is like:

<?php
  $fp = fsockopen("www.google.com",80);
  fputs($fp, "GET / HTTP/1.0\r\n\r\n");
  $data="";
  while (!feof($fp)) $data.=fgets($fp,64000);
  fclose($fp);

I know I can change the code to use a proxy like:

<?php
  $fp = fsockopen("exampleproxy.com",3128);
  fputs($fp, "GET http://www.google.com HTTP/1.0\r\n\r\n");
  $data="";
  while (!feof($fp)) $data.=fgets($fp,64000);
  fclose($fp);

But can I configure a system-wide proxy to let all the internet traffic go through that proxy so that I do not need to change the code? I am on Centos 7.

Source