How to remove this response?

@fretburner,

I am using Curl in php,I have this response

------------------------------59ff10f12d1d
Content-Disposition: form-data; name="theres"

My Name
------------------------------59ff10f12d1d--

I want only My Name to be the response.

I tried CURLOPT_HEADER => false, still not working

Thank you in advance

Hey jemz, are you still having trouble with this, or did you find a solution?

If it’s still not working, can you post the PHP code that you’re using to make the request, so we can try to recreate the problem?

$curl = curl_init();

$resultserv = "My Name";
curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => 'http://127.0.0.1:1337',
    CURLOPT_HEADER => false,
    CURLOPT_ENCODING => "UTF-8",
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => array(
        'theres' => $resultserv

    )
));


$resp = curl_exec($curl);

curl_close($curl);

echo $resp;

and my readrequest.js

http.createServer(function(request,response){
    response.writeHead(200, {'Content-Type': 'text/plain'} );
    request.pipe(response);

}).listen(1337,'127.0.0.1');

console.log('Server running at  http://127.0.0.1:1337/');

can you help me please is there something wrong with the code ?

Those aren’t the headers that you’re outputting, it’s actually the raw request body with the POST variable you sent.

I’m not that familiar with Node.js, but it seems that to access the post data is actually quite complicated, and you’ll probably be better off with a framework like Express that abstracts all the low-level HTTP stuff for you.

Hi,fretburner correct me if I am wrong,so it’s better to use the framework like express ?

Thank you in advance.

What exactly are you trying to achieve? Are you just experimenting with Node.js, or you have a specific project in mind?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.