I am a php noob and I have tried a few things and nothing so far has worked.

I need to find some php code that allows me to do an http post and return the results into an array so I can parse the results for a string.

The problems I have are file get content is not enabled on the server, CURL is not installed on the server and I cant install anything on the server.

I am creating session variables from the form input then passing those variables into a php transaction to post to the site and verify the transaction results.


// start the session
header("Cache-control: private");
$username = $_POST;
$password = $_POST;
$_SESSION = $username;
$_SESSION = $password;

Next step I need to actually login behind the scenes with the php post and parse the results for the status (This is where I am losing the whole thing I cant seem to get this done)

Any ideas anyone ??

9 Years
Discussion Span
Last Post by becraig

First, I would not suggest taking POST variables (or $_GET or $_REQUEST etc..) and put them straight into sessions for use later, I would suggest you look into checking/sanitizing the results to ensure that they are what is expected. Especially if you are then using these values to query a database.

Can you post the actual code that is causing the problem? Your post indicates that it is the code after this that is causing the problem..

Also, try to use code tags, makes it easier for us to separate the code from your question.

Edited by Will Gresham: n/a


This is what I tried using but no help

$content = '';
$flag = false;
$post_query = 'username=$_SESSION&password=$_SESSION';
$post_query = urlencode($post_query) . "\r\n";
$host = 'www.somesite.com';
$path = '/somefolder/someapp.php';
$fp = fsockopen($host, '80');
// This is plain HTTP; for HTTPS, use
// $fp = fsockopen($host, '443');
if ($fp) {
fputs($fp, "POST $path HTTP/1.0\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-length: ". strlen($post_query) ."\r\n\r\n");
fputs($fp, $post_query);
while (!feof($fp)) {
$line = fgets($fp, 10240);
if ($flag) {
$content .= $line;
} else {
$headers .= $line;
if (strlen(trim($line)) == 0) {
$flag = true;


echo $content;
echo $headers;


as for the session issue I run a session destroy if the validation fails.

Edited by happygeek: fixed formatting


However I have a new wrinkle how in the world do I get to authenticate the browser session now I have determined the values are correct


ok now I need help with my preg match

do action
do some other action

I really dont even know if that is correct :(

Edited by mike_2000_17: Fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.