sending custom headers with HttpResponse

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
netgoons
Forum Newbie
Posts: 7
Joined: Sat Feb 20, 2010 2:23 am
Location: New Delhi

sending custom headers with HttpResponse

Post 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.
netgoons
Forum Newbie
Posts: 7
Joined: Sat Feb 20, 2010 2:23 am
Location: New Delhi

Re: sending custom headers with HttpResponse

Post by netgoons »

23 views and no reply.*Disappointed*. Does no one use such a feature?
ansh9d
Forum Newbie
Posts: 2
Joined: Sun Feb 21, 2010 6:38 am

Re: sending custom headers with HttpResponse

Post 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.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: sending custom headers with HttpResponse

Post 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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
netgoons
Forum Newbie
Posts: 7
Joined: Sat Feb 20, 2010 2:23 am
Location: New Delhi

Re: sending custom headers with HttpResponse

Post 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.
User avatar
timWebUK
Forum Contributor
Posts: 239
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Re: sending custom headers with HttpResponse

Post by timWebUK »

You could look into sockets and send them that way?

http://us2.php.net/manual/en/function.fsockopen.php
Post Reply