Jump to content

fsockopen and paths problem


radarmaker

Recommended Posts

I'm using a script that does a number of functions, but the one i need most isn't working.

 

It basically sends a message built from a database to a list of imported users.

 

the two pages are mailings.php and mailout.php.

 

i've identified what i think is the problem but can't for the life of me figure it out.

i'm on a mediatemple DV server (VPS) and my apache document root is set to /var/www/html though the individual domains i'm working at have roots at /var/www/vhosts/domain/httpdocs

 

the script snippet is here:

 

 $webdomain = str_replace('www.', '', $_SERVER['SERVER_NAME']);
                   $inslocurl = str_replace('/mailings.php', '/mailout.php', $_SERVER['PHP_SELF']);

                   $postvars = array();
            while (list ($key, $value) = each ($HTTP_POST_VARS))
            {
                   $postvars[] = $key;
                                  }
                   $enc_pass=md5($user_pass);
                   $posting = "mode=mailings&auth=$enc_pass";
            for ($var = 0; $var < count ($postvars); $var++)
            {
                   $postkey = $postvars[$var];
                   $postvalue = $$postvars[$var];
                   $posting .= "&" . $postkey . "=" . urlencode ($postvalue);
                                  }
							  

	   $fp = fsockopen ("$webdomain", 80, $errno, $errstr, 30);
	   $header .= "POST $inslocurl HTTP/1.0\r\n";
	   $header .= "HOST: $webdomain\r\n";
	   $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
	   $header .= "Content-Length: " . strlen ($posting) . "\r\n";
	   $header .= "Connection: Close\r\n\r\n";
            fputs ($fp, $header . $posting);
            fclose ($fp);

 

when i call the $inslocurl variable it keeps trying to get /var/www/html/folder (instead of the /var/www/vhosts/domain/httpdocs/folder) which seems to be the problem in the script not actually running.

 

This script is built on an earlier verison of php (i'm running 5.2) but most of the functions work with a fiddle with .htaccess, and i don't know if this particular error is to do with the version of PHP or a setup on my server. The whole site is built on php and i've never encountered this problem before.

 

any help is greatly appreciated!!!

Link to comment
https://forums.phpfreaks.com/topic/145329-fsockopen-and-paths-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.