php - send http request with CURL to local file -


hello need send http request local file using file name self not full http path example

    <?php $url = 'http://localhost/te/fe.php'; // submitted form data, encoded query-string-style // name-value pairs $body = 'monkey=uncle&rhino=aunt'; $c = curl_init ($url); curl_setopt ($c, curlopt_post, true); curl_setopt ($c, curlopt_postfields, $body); curl_setopt ($c, curlopt_returntransfer, true); $page = curl_exec ($c); curl_close ($c); ?> 

i need become this

<?php $url = 'fe.php'; // submitted form data, encoded query-string-style // name-value pairs $body = 'monkey=uncle&rhino=aunt'; $c = curl_init ($url); curl_setopt ($c, curlopt_post, true); curl_setopt ($c, curlopt_postfields, $body); curl_setopt ($c, curlopt_returntransfer, true); $page = curl_exec ($c); curl_close ($c); ?> 

when tried second example doesn't make anything. there solution using curl or other method ? thank you

you can't post local file, it's http method. , can't post relative url, because server-side call. what's going relative to?

if fe.php accessible outside, and web server can reach on interface, build dynamic url so:

$schema = isset($_server["https"]) ? "https:" : "http:" $url    = "$schema//$_server[http_host]/te/fe.php"; 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -