Hi,
Here is a small but working script which emulate post. You can post any
type of data as a form field.

http://www.zend.com/codex.php?id=77&single=1

But as many other users have suggested, I think SOAP is the best thing
to try.

Visit 
http://sourceforge.net/projects/nusoap/

 
Zareef Ahmed

-----Original Message-----
From: Jesse Castro [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 7:13 PM
To: Victor C.
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] file upload


> Ahh, if you *have* to push the data (which you obviously do) and the 
> authentication site has no other authentication methods then you have 
> to POST the file with PHP. It can be done, there are many classes for 
> it, I can't recommend any specific class, but I'm sure someone else 
> here could.
>
> I would surprise me if something in PEAR ( http://pear.php.net/ ) 
> couldn't do it. Just look for an HTTP class that can POST files.
>
> Chris
>
> Victor C. wrote:
>
>> See... basically, I have two sites. One site provides user 
>> authentication and another one requests the authentication. The 
>> requesting site need
to
>> send to the authentication site its request in an XML.  The
>> authentication
>> site is suppose to get the XML file using $HTTP_POST_FILES.  I'm 
>> using PHP
>> to dynamically generate the request XML file and I need to submit it 
>> to the
>> authenticating site; but I don't want to use file upload and browse
>> functionality, because the authentication process is suppose to be
>> transparent to the end users.
>>
>> Again, thanx for the help and any insights would be greatly 
>> appreciated. :)
>>
>
Victor,

I have recently come across the same problem.  Microsoft supplied a very
nice method to submit xml files in asp.  Unfortunately, it is harder to
implement in PHP.  The script below is what I eventually came up with,
and it works for me.  Don't know if it applies to your situation
exactly, but hope it helps at any rate.

Cheers,
Jesse R. Castro


$xmlRequest = "<request>\n";
$xmlRequest.= "\t<contents>foo</contents>\n";
$xmlRequest.= "</request>";

$url = "http://www.wherever.com";;
$port = "83";
$path = "/path/to/script.asp"

/*
*       $errno and $errstr are blank, see the docs for fsockopen
*/

$sockXml = fsockopen($url, $port, $errno, $errstr, 30);

if (!$sockXml) {
   echo $errstr." (".$errno.")<br />\n";
} else {
/*
*       http headers
*/
        $out = "POST ".$path." HTTP/1.1\n";
        $out .= "Host: www.wherever.com:83\n";
        $out .= "Content-Type: application/x-www-form-urlencoded\n"; 
        $out .= "Content-Length: ".strlen($xmlRequest)."\n"; 
        $out .= "Connection: Close\n";
        $out .= "\n".$xmlRequest; 
        $out .= "\n" ;

/*
*       write the http headers to the open socket
*/      
   fwrite($sockXml, $out);

/*
*       get the results back
*/
   $strReturned = "";
   while (!feof($sockXml)) {
                $strReturned.= @fgets($sockXml, 4096);
   }
   echo $strReturned."\n";

------------------------------------------------------------------------
--
Zareef Ahmed :: A PHP develoepr in Delhi ( India )
Homepage :: http://www.zasaifi.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to