Page 1 of 1
sending custom headers with HttpResponse
Posted: Sat Feb 20, 2010 2:32 am
by netgoons
Hey Guys. this is my first post in this forum.
I was trying to send a custom header to another page for accessing its api.
I am using this HttpResponse::setHeader ( 'customname', 'myvalue' );
What class do I need to use for this? Does PHP5.1 and above have this inbuilt or do I need to include some particular class to use this? How do I create and instance of this class? Any help is appreciated.
Re: sending custom headers with HttpResponse
Posted: Mon Feb 22, 2010 1:15 am
by netgoons
23 views and no reply.*Disappointed*. Does no one use such a feature?
Re: sending custom headers with HttpResponse
Posted: Mon Feb 22, 2010 8:48 am
by ansh9d
try to use
<?php
header("location: index.php");
exit();
?>
if u are not satisfied then mail me.
i'll send u the source code to post values to different pages
without opening the pages using socket.
Re: sending custom headers with HttpResponse
Posted: Mon Feb 22, 2010 9:21 am
by AbraCadaver
You would get more help if you outlined a little more about what you are trying to do. I would assume that you would want HttpRequest to actually request something and then HttpResponse respond.
Re: sending custom headers with HttpResponse
Posted: Fri Feb 26, 2010 3:42 am
by netgoons
I have a simple need. I need to send some information in http headers using php. I need to access a api and I have an api key the api key needs to be sent in the header.
Location is for redirecting and not for sending custom headers. I found this method on one tutorial - HttpResponse::setHeader ( 'customname', 'myvalue' ); but it wont work as the class definition is not there. Hence the php errror.
Re: sending custom headers with HttpResponse
Posted: Fri Feb 26, 2010 3:52 am
by timWebUK
You could look into sockets and send them that way?
http://us2.php.net/manual/en/function.fsockopen.php