diff --git a/NetPHP.php b/NetPHP.php index ee59fe0..5fe5fed 100644 --- a/NetPHP.php +++ b/NetPHP.php @@ -32,7 +32,7 @@ function get_headers_from_curl_response($headerContent) { } return $headers; } -function post($url,$values,$headers=[],$reffer="",$auto_redirect=true) { +function post($url,$values=[],$headers=[],$reffer="",$auto_redirect=true) { global $debug,$debug_details; if($debug) { print "@Request[POST]----------------------------------------------\n"; @@ -73,6 +73,7 @@ function post($url,$values,$headers=[],$reffer="",$auto_redirect=true) { $header_size = curl_getinfo($curl,CURLINFO_HEADER_SIZE); $header = substr($response,0,$header_size); $body = substr($response,$header_size); + $httpCode = curl_getinfo($curl,CURLINFO_HTTP_CODE); curl_close($curl); if($debug && $debug_details) { print "----------@Response Headers\n"; @@ -81,7 +82,6 @@ function post($url,$values,$headers=[],$reffer="",$auto_redirect=true) { print_r($body); print "\n"; } - $httpCode = curl_getinfo($curl,CURLINFO_HTTP_CODE); if($httpCode == 404) { return false; } @@ -124,6 +124,7 @@ function get($url,$headers=[],$reffer="",$auto_redirect=true) $header_size = curl_getinfo($curl,CURLINFO_HEADER_SIZE); $header = substr($response,0,$header_size); $body = substr($response,$header_size); + $httpCode = curl_getinfo($curl,CURLINFO_HTTP_CODE); curl_close($curl); if($debug && $debug_details) { print "----------@Response Headers\n"; @@ -132,7 +133,6 @@ function get($url,$headers=[],$reffer="",$auto_redirect=true) print_r($body); print "\n"; } - $httpCode = curl_getinfo($curl,CURLINFO_HTTP_CODE); if($httpCode == 404) { return false; } diff --git a/README.md b/README.md index 4101970..d2e5790 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,25 @@ -# NetPHP +# Net PHP Useful functions for connecting to the network in the PHP based applications. + +## Features + +- Send GET Requests +- Send POST Requests +- Support Cookie Manager +- Ability to send headers to requests +- Ability to set the referrer URL header. +- Parse Response Headers +- Detect 404 pages and return a `False` value(bool)... [[v1.1]](https://github.com/BaseMax/NetPHP/releases/tag/1.1) + +--------- + +# Max Base + +My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers. ([Max Base](https://maxbase.org/)) + +## Asrez Team + +A team includes some programmer, developer, designer, researcher(s) especially Max Base. + +[Asrez Team](https://www.asrez.com/)