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'.

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.