I will explain with a simple example:
myphp1.php:
$html = get_html("myphp2.php", "parameter1"); //pseudocode
myphp2.php
<html>
<head>
</head>
<body>
<?php
echo $_POST["parameter1"];
?>
</body>
</html>
So basically the $html will hold the myphp2.php html output. Can I do that?
If you are looking to interpret the php script, and save the output, you should send a new request.
Using PHP5 you can do this without curl:
$url = 'http://www.domain.com/mypage2.php';
$data = array('parameter1' => 'value1', 'parameter2' => 'value2');
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$html = file_get_contents($url, false, $context);
var_dump($html);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With