Jump to content

HTTP extension unavailable in shared hosting.


Michael9

Recommended Posts

hey people,

I wrote some simple script that works on my computer [winXp+ apache + php5]

the script uses the HTTP extension:

http://www.php.net/manual/en/ref.http.php

In fact, it just uses the http_post_data() function.

 

the thing is that my hosting provider [free shared hosting] doesn't support this function.

is there any way to make this function work on the hosting server?

maybe if I upload the files that contain this function and all the related classes, and the use include() or something like this. I have no idea...

 

If there's no way to do this, I'll be glad if you tell me what free hosting service supports this.

and if you don't know, maybe you can tell me how to do the same that http_post_data() but without using it ;)

I know that I can use sockets, but I don't know how to calculate the 'content-size' header.

the http_post_data() does this automatically, you just need to provide the post data and it generates the correct 'content-size'.

so, someone know how to send POST data?

I can use socket_create(), socket_connect(), socket_write() and other socket functions.

but the header looks like this:

/POST: /path/to/some/page \r\n
Host: domain.com \r\n
user-agent: firefox \r\n
content-type: text/html
[color=red]content-size: 1564[/color] \r\n
\r\n  //empty line to tell the server it's the end of the headers
$some_string   \\after the headers we send the server the actual content, which is in my example in size 1564

 

so my problem is to calculate the 'content size', I have  the content string but have no idea how to calculate it's size. I don't think it's just len(), maybe I cna send a fake size that probably be bigger from the real size?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.