How to make a PUT HTTP REQUEST to (http://sample.com:8888/folder) with a Random-Header and REQUEST-BODY with JSON String {"key": "la09823", "content": "jfkdls"} HTTP status code 200 OK would be nice. Sorry for my first socket confusing php code :D<3. thx
<?php $json = "\{\"key\": \"la09823\", \"content\": \"jfkdls\"}"; $hostname="http://sample.com/folder"); $port = 8888; $timeout = 50; $socket = socket_create(AF_INET, SOCK_STREAM, tcp); socket_connect($socket, $hostname, $port); $text = "PUT /folder/json.txt" HTTP/1.1\n"; $text .= "Host: WhoIAm.com\n"; $text .= "Content-Type: application/json\n"; $text .= "Content-length: " . strlen($json) . "\n"; $finish = $text + $json; socket_write($socket, $finish, 0); socket_close($socket); ?>
$text =line)