Error in php script

Hello! I am creating an application for VKontakte, and I need to send a request to apion php,
but it doesn’t work, there is no curl on my hosting, so I came to the conclusion that I need to do it through sockets, but it doesn’t work.
Here is the code.

$socket = fsockopen('ssl://', 443, $errno, $errstr, 60);
// fsockopen  false,          
$data = "uid=1&access_token=1c5553a351f297fe1f4756e93b1fa4792c91f821f85e9ff8185e85cb97579bd";
//   , URI   
fwrite($socket, "POST /method/audio.get HTTP/1.1\r\n");
fwrite($socket, "Host:\r\n");
//Content-type   applicaion/x-www-form-urlencoded
fwrite($socket,"Content-type: application/x-www-form-urlencoded\r\n");
//      Content-length
//  . */* ,     
fwrite($socket,"User-agent:Opera 10.00\r\n");
$answer = '';
    $answer.= fgets($socket, 4096);
echo $answer;

Answer 1, authority 100%

Sorry, I didn’t see about curl.

Well, isn’t that an option?

$context = stream_context_create(array(
    'http' => array(
        'method' => 'POST',
        'header' => 'Content-Type: application/x-www-form-urlencoded' . PHP_EOL,
        'content' => "uid=1&access_token=1c5553a351f297fe1f4756e93b1fa4792c91f821f85e9ff8185e85cb97579bd",
$answer = file_get_contents(
    $file = "",
    $use_include_path = false,

Answer 2, authority 100%

I noticed just now, you are using a local server for testing, the letter Z in the drive name tells me that you are using Denver. So:

  1. Find php.ini in Z:\usr\local\php5\
  2. Open it with any text editor
  3. Find the line ;extension=php_openssl.dll and uncomment it, i.e. remove ;
  4. Save and restart the server.

Total business.

Answer 3

I don’t know about you.. But other than on the inscribed servers in the application for which you received the token, nothing should work. There is a binding to the server! The contact sends data if the script runs from the server specified in the application. In other cases, the token will not work!