PHP Classes

Send a porm

Recommend this page to a friend!

      PHP HTTP protocol client  >  All threads  >  Send a porm  >  (Un) Subscribe thread alerts  
Subject:Send a porm
Summary:Populate the form and send it with predefined values
Messages:9
Author:Petar
Date:2007-10-30 11:06:21
Update:2007-10-31 17:59:02
 

  1. Send a porm   Reply   Report abuse  
Picture of Petar Petar - 2007-10-30 11:06:21
Hi,

I can not udestand ho wto use the class. There are so many functions..

In sgort I want to open a given webpage with a form in it. There are some hidden fields. I want to grab their values, pupulate the others and send the form (POST METHOD).

What I have to do?


  2. Re: Send a form   Reply   Report abuse  
Picture of Petar Petar - 2007-10-30 11:35:44 - In reply to message 1 from Petar
Is it possible to hire you to write me an exmple? I want to open a webapge wih a form, save cookies if there are any, populate the necessary data and post the form just the standard webbrowser does it.


  3. Re: Send a porm   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-10-30 12:01:50 - In reply to message 1 from Petar
You need to set the PostValues to an array with all form values. Take a look at the test_http_post.php example script.

To grab the initial values of hidden form fields, you need to grab the form page possibly with a simple GET request. Then you use regular expression functions like preg_match to extract the values of the fields.

  4. Re: Send a porm   Reply   Report abuse  
Picture of Petar Petar - 2007-10-30 13:34:22 - In reply to message 3 from Manuel Lemos
GetRequestArguments + Open + SendRequest + ReadReplyHeaders + ReadReplyBody --> then parse the body to get the form variables or there is a simple (better) way?

  5. Re: Send a porm   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-10-30 15:17:37 - In reply to message 4 from Petar
Yes, that is the way to do it as you need.

  6. Re: Send a porm   Reply   Report abuse  
Picture of Petar Petar - 2007-10-30 16:01:24 - In reply to message 5 from Manuel Lemos
What about GetRequest and OpenRequest? When they are necessary?

  7. Re: Send a porm   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-10-30 16:58:19 - In reply to message 6 from Petar
There are no such functions in this class. You may be confusing with something else.

  8. Re: Send a porm   Reply   Report abuse  
Picture of Petar Petar - 2007-10-31 09:10:35 - In reply to message 7 from Manuel Lemos
Yes. They are from yahoo example...

Could you help me how to add Host header? I try to access a website via transparent proxy and the following error appears:

While the Host header is generally optional for HTTP, it is required for CoDeeN. Furthermore, numerical hostnames are not allowed. Please add this header and try again.

Thank you

  9. Re: Send a porm   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-10-31 17:59:03 - In reply to message 8 from Petar
The Host: header is generated by the class from the domain you used in the request URL. If you used an IP address there is no way it can figure the real host name. Just use a request URL that uses the real host name as domain.