Skip to content

Instantly share code, notes, and snippets.

View NnaDid's full-sized avatar
🎯
Focusing

Didigwu Nnaemeka Christian NnaDid

🎯
Focusing
View GitHub Profile
@NnaDid
NnaDid / request_no_curl.php
Created February 16, 2020 08:15 — forked from iNaD/request_no_curl.php
Sending a GET/POST Request via PHP without CURL (fopen needs to be enabled)
<?php
$url = 'http://server.com/path';
$data = array('key1' => 'value1', 'key2' => 'value2');
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),