Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > HTTP::Post - HTTP::Get (Can someone help me?)

Reply
Thread Tools

HTTP::Post - HTTP::Get (Can someone help me?)

 
 
Fred
Guest
Posts: n/a
 
      04-23-2008
Hello,

I'm lost.
Can someone explain good to me what the difference is between these 2
methods?

I have a HTTPost and when i check the body, i see exacly what he has
to do. But it doesn't do it in reality.
How can i resolve the problem?

thank you
 
Reply With Quote
 
 
 
 
darren kirby
Guest
Posts: n/a
 
      04-23-2008
quoth the Fred:
> Hello,
>
> I'm lost.
> Can someone explain good to me what the difference is between these 2
> methods?


'GET' and 'POST' are two 'request methods' which are part of the HTTP spec.
Your two methods are ruby implementations of such request methods. Read this:
http://en.wikipedia.org/wiki/Http#Request_methods

...and you will see they are quite different.

> I have a HTTPost and when i check the body, i see exacly what he has
> to do. But it doesn't do it in reality.
> How can i resolve the problem?


I have no idea what you are getting at here. Please repost with:
* A clear description of what you want to accomplish
* How what you are doing now is failing (include error messages)
* Your failing code
* excerpt of your data causing a failure (if applicable)

If you include all this, you will certainly recieve a more helpful response.

> thank you


-d
--
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972

 
Reply With Quote
 
 
 
 
Fred
Guest
Posts: n/a
 
      04-24-2008
Thanx Darren for the info

What i want to do:

Interact with a site and change behaviour without going to the site itself.

I have to do 2 steps.


def connect
uri = URI.parse(BASE_ADDRESS)
HTTP.version_1_1
@http = HTTP.start(uri.host, uri.port)
end

1. The first one succeed with

connect
req = HTTP:ost.new("...")
add_headers req, "......"
res = @http.request(req)
puts res.body
@http.finish

When i look into res.body i see that the first step is good.

2. Now the second step is to simulate a POST (submit button) from the
first step.

req = HTTP:ost.new("....")
add_headers req, "...."
connect
res = @http.request(req)
puts res.body
@http.finish

When i look into res.body i see nothing.
I also tried the connect before the req in the second step but it
changed nothing.

The second step has to change the first step ( activate the submit
button) but it doesn't work.

I hope you understand it a little bit.

Can someone help me with this?

Thanks



darren kirby schreef:
> quoth the Fred:
>> Hello,
>>
>> I'm lost.
>> Can someone explain good to me what the difference is between these 2
>> methods?

>
> 'GET' and 'POST' are two 'request methods' which are part of the HTTP spec.
> Your two methods are ruby implementations of such request methods. Read this:
> http://en.wikipedia.org/wiki/Http#Request_methods
>
> ..and you will see they are quite different.
>
>> I have a HTTPost and when i check the body, i see exacly what he has
>> to do. But it doesn't do it in reality.
>> How can i resolve the problem?

>
> I have no idea what you are getting at here. Please repost with:
> * A clear description of what you want to accomplish
> * How what you are doing now is failing (include error messages)
> * Your failing code
> * excerpt of your data causing a failure (if applicable)
>
> If you include all this, you will certainly recieve a more helpful response.
>
>> thank you

>
> -d

 
Reply With Quote
 
7stud --
Guest
Posts: n/a
 
      04-24-2008
What's in step 1's resp.body? Is it html? Do you want to extract a url
from that html and send a request to that url?
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Fred
Guest
Posts: n/a
 
      04-24-2008
resp.body is a php page => purpose is to see of step 1 is working

7stud -- schreef:
> What's in step 1's resp.body? Is it html? Do you want to extract a url
> from that html and send a request to that url?



Fred schreef:
> Thanx Darren for the info
>
> What i want to do:
>
> Interact with a site and change behaviour without going to the site itself.
>
> I have to do 2 steps.
>
>
> def connect
> uri = URI.parse(BASE_ADDRESS)
> HTTP.version_1_1
> @http = HTTP.start(uri.host, uri.port)
> end
>
> 1. The first one succeed with
>
> connect
> req = HTTP:ost.new("...")
> add_headers req, "......"
> res = @http.request(req)
> puts res.body
> @http.finish
>
> When i look into res.body i see that the first step is good.
>
> 2. Now the second step is to simulate a POST (submit button) from the
> first step.
>
> req = HTTP:ost.new("....")
> add_headers req, "...."
> connect
> res = @http.request(req)
> puts res.body
> @http.finish
>
> When i look into res.body i see nothing.
> I also tried the connect before the req in the second step but it
> changed nothing.
>
> The second step has to change the first step ( activate the submit
> button) but it doesn't work.
>
> I hope you understand it a little bit.
>
> Can someone help me with this?
>
> Thanks
>
>
>
> darren kirby schreef:
>> quoth the Fred:
>>> Hello,
>>>
>>> I'm lost.
>>> Can someone explain good to me what the difference is between these 2
>>> methods?

>>
>> 'GET' and 'POST' are two 'request methods' which are part of the HTTP
>> spec. Your two methods are ruby implementations of such request
>> methods. Read this: http://en.wikipedia.org/wiki/Http#Request_methods
>>
>> ..and you will see they are quite different.
>>
>>> I have a HTTPost and when i check the body, i see exacly what he has
>>> to do. But it doesn't do it in reality.
>>> How can i resolve the problem?

>>
>> I have no idea what you are getting at here. Please repost with:
>> * A clear description of what you want to accomplish
>> * How what you are doing now is failing (include error messages)
>> * Your failing code
>> * excerpt of your data causing a failure (if applicable)
>>
>> If you include all this, you will certainly recieve a more helpful
>> response.
>>
>>> thank you

>>
>> -d

 
Reply With Quote
 
Fred
Guest
Posts: n/a
 
      04-24-2008
The First step is to insert javascript into PHP page.
In puts res.body i can see if it works and it works.
The second step is to activate the submit button from the first step,
and this isn't working.

thnx

Fred schreef:
> resp.body is a php page => purpose is to see of step 1 is working
>
> 7stud -- schreef:
> > What's in step 1's resp.body? Is it html? Do you want to extract a url
> > from that html and send a request to that url?

>
>
> Fred schreef:
>> Thanx Darren for the info
>>
>> What i want to do:
>>
>> Interact with a site and change behaviour without going to the site
>> itself.
>>
>> I have to do 2 steps.
>>
>>
>> def connect
>> uri = URI.parse(BASE_ADDRESS)
>> HTTP.version_1_1
>> @http = HTTP.start(uri.host, uri.port)
>> end
>>
>> 1. The first one succeed with
>>
>> connect
>> req = HTTP:ost.new("...")
>> add_headers req, "......"
>> res = @http.request(req)
>> puts res.body
>> @http.finish
>>
>> When i look into res.body i see that the first step is good.
>>
>> 2. Now the second step is to simulate a POST (submit button) from the
>> first step.
>>
>> req = HTTP:ost.new("....")
>> add_headers req, "...."
>> connect
>> res = @http.request(req)
>> puts res.body
>> @http.finish
>>
>> When i look into res.body i see nothing.
>> I also tried the connect before the req in the second step but it
>> changed nothing.
>>
>> The second step has to change the first step ( activate the submit
>> button) but it doesn't work.
>>
>> I hope you understand it a little bit.
>>
>> Can someone help me with this?
>>
>> Thanks
>>
>>
>>
>> darren kirby schreef:
>>> quoth the Fred:
>>>> Hello,
>>>>
>>>> I'm lost.
>>>> Can someone explain good to me what the difference is between these 2
>>>> methods?
>>>
>>> 'GET' and 'POST' are two 'request methods' which are part of the HTTP
>>> spec. Your two methods are ruby implementations of such request
>>> methods. Read this: http://en.wikipedia.org/wiki/Http#Request_methods
>>>
>>> ..and you will see they are quite different.
>>>
>>>> I have a HTTPost and when i check the body, i see exacly what he has
>>>> to do. But it doesn't do it in reality.
>>>> How can i resolve the problem?
>>>
>>> I have no idea what you are getting at here. Please repost with:
>>> * A clear description of what you want to accomplish
>>> * How what you are doing now is failing (include error messages)
>>> * Your failing code
>>> * excerpt of your data causing a failure (if applicable)
>>>
>>> If you include all this, you will certainly recieve a more helpful
>>> response.
>>>
>>>> thank you
>>>
>>> -d

 
Reply With Quote
 
Avdi Grimm
Guest
Posts: n/a
 
      04-24-2008
On Thu, Apr 24, 2008 at 6:30 AM, Fred <(E-Mail Removed)> wrote:
> The First step is to insert javascript into PHP page.
> In puts res.body i can see if it works and it works.
> The second step is to activate the submit button from the first step, and
> this isn't working.


What status code is the second request returning?

--
Avdi

Home: http://avdi.org
Developer Blog: http://avdi.org/devblog/
Twitter: http://twitter.com/avdi
Journal: http://avdi.livejournal.com

 
Reply With Quote
 
Fred
Guest
Posts: n/a
 
      04-24-2008
Avdi Grimm schreef:
> On Thu, Apr 24, 2008 at 6:30 AM, Fred <(E-Mail Removed)> wrote:
>> The First step is to insert javascript into PHP page.
>> In puts res.body i can see if it works and it works.
>> The second step is to activate the submit button from the first step, and
>> this isn't working.

>
> What status code is the second request returning?
>


Do you mean what he returns when i puts res.body?

He doesn't output anything?
 
Reply With Quote
 
Avdi Grimm
Guest
Posts: n/a
 
      04-24-2008
I mean the HTTP status code - e.g. 302, 200, 404, etc. What is the
value of the response.code and response.message?

On 4/24/08, Fred <(E-Mail Removed)> wrote:
> Avdi Grimm schreef:
> > On Thu, Apr 24, 2008 at 6:30 AM, Fred <(E-Mail Removed)> wrote:
> >> The First step is to insert javascript into PHP page.
> >> In puts res.body i can see if it works and it works.
> >> The second step is to activate the submit button from the first step,

> and
> >> this isn't working.

> >
> > What status code is the second request returning?
> >

>
> Do you mean what he returns when i puts res.body?
>
> He doesn't output anything?
>
>


--
Sent from Gmail for mobile | mobile.google.com

Avdi

Home: http://avdi.org
Developer Blog: http://avdi.org/devblog/
Twitter: http://twitter.com/avdi
Journal: http://avdi.livejournal.com

 
Reply With Quote
 
Fred
Guest
Posts: n/a
 
      04-24-2008
puts "#{res.code} #{res.message}\n"

Gives me:

302 Found


Avdi Grimm schreef:
> I mean the HTTP status code - e.g. 302, 200, 404, etc. What is the
> value of the response.code and response.message?
>
> On 4/24/08, Fred <(E-Mail Removed)> wrote:
>> Avdi Grimm schreef:
>>> On Thu, Apr 24, 2008 at 6:30 AM, Fred <(E-Mail Removed)> wrote:
>>>> The First step is to insert javascript into PHP page.
>>>> In puts res.body i can see if it works and it works.
>>>> The second step is to activate the submit button from the first step,

>> and
>>>> this isn't working.
>>> What status code is the second request returning?
>>>

>> Do you mean what he returns when i puts res.body?
>>
>> He doesn't output anything?
>>
>>

>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need help with my computer. someone help! please. kristinafamousx The Lounge 3 06-22-2009 12:29 AM
HELP ME!!! OH for the love of ... Please help me, someone MUST KNOW!!! PORTfAR HTML 1 02-25-2005 12:51 AM
Help can someone plz help me Johnny26 Computer Support 1 02-24-2005 10:52 PM
Re: I m gonna mad Plz someone help me Toby Considine ASP .Net 0 08-31-2003 08:13 PM
Someone please help... Randy Microsoft Certification 0 07-16-2003 02:39 AM



Advertisments