$_REQUEST["text"]); $data[$field]=$_REQUEST[$field]; } } $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => ((count($data)>0) ? "POST" : "GET"), 'content' => http_build_query($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); if ($result === FALSE) { echo "Viga"; } else {echo $result;}