Jump to content

Recommended Posts

Maybe you could use Curl..

 

<?php
//set up variables
$url = "http://www.domainname.com/file.php";
$fields = "anything=something";

//execute Curl
$c = curl_init($url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($c, CURLOPT_POSTFIELDS, $fields);   //sending over post variables here
$data = curl_exec($c);
curl_close($c);

 

While looking at some of my code I found another example on line.  Here it is..

 

<?php
//curl6.php

// populate the array containing the values to be posted.
$postfields = array();
$postfields['field1'] = urlencode('value1');
$postfields['field2'] = urlencode('value2');

$ch = curl_init();

// Follow any Location headers
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($ch, CURLOPT_URL, 'http://www.example.co.za/recipient2.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// Alert cURL to the fact that we're doing a POST, and pass the associative array for POSTing.
curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

$output = curl_exec($ch);
curl_close($ch);
print $output;
?>

 

Good luck

I am tring to pass a POST to an include in some way, here is what I had in mind:

 

$_POST[anything] = 'something';

 

into:

 

include "http://www.domainname.com/file.php";

 

when file is:

 

<?PHP

  echo "$_POST[anything]";

?>

 

Thanks

 

what you are saying is simply impossible because an included/required/required_once file is like pasting its raw unsent source code into it so it has no real location to send.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.