Jump to content

post data to a remote file


mariom

Recommended Posts

can you give us a clue?  We prolly could help, but we would need to know what kind of data it returns. if it's a standard website, You'll most likely need to use CuRL, if it's XML or SOAP, that's different. There are many ways to do it, but we would need more information to give a decent answer.

your subject line says "remote file" but your message say's "remote site" which is it?

 

the first one is easy, the latter is a bit trickier as cross-site-scripting is difficult if you don't administer the second site.  your best bet then is screen-scraping.

 

what exactly are you trying to do?

Sorry about the delay everyone,

I've been searching the internet and trying stuff .

The problem is, I have to authenticate users using an authentication file from another server. I need to take their data from my page to the remote authentication page then gather the results from that page back to my page.

 

 

CURL is your best bet. But if you want an alternative try this:

<?php
$data=array('foo'=>'bar','bar'=>'baz');
$data=http_build_query($data);
$context_options=array('http'=>array('method'=>'POST',
         'header'=>"Content-type: application/x-www-form-urlencoded\r\n".
         'Content-Length: '.strlen($data)."\r\n",
         'content'=>$data));
$context=stream_context_create($context_options);
$fp=file_get_contents('http://127.0.0.1/test2.php', FALSE, $context);
var_dump($fp);
?>

Hey guys,

I'm using the latest version of phpmailer. Is it possible to authenticate a user without sending them mail?

I'm using SMTP by the way.

That's the only way I could get around my woes right now.

 

Since you state who you are sending the email to, you can define it anyway you want.  Here is an example.

 

require_once "Mail.php";

$to = "Me <[email protected]>";

$headers["From"] = "Me <[email protected]>";
$headers["Subject"] = "My Email";

$smtp["host"] = "localhost";
$smtp["port"] = "26";
$smtp["auth"] = true;
$smtp["username"] = "[email protected]";
$smtp["password"] = "password";

$msg = "This is what I want to say.";

// Sends the email
$mail = Mail::factory('smtp', $smtp);

$mail->send($to, $headers, $msg)
or die('Error while processing your submission.');

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.