Jump to content

Best programming language to make web POST / GET requests

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
eth4rendil

eth4rendil

    Newbie

  • Members
  • Pip
  • 7 posts
Hi There,

I have one question. In which language can i wrote the fastest "script/program", which can make GET and POST requests to lagged web site. I'm trying to GET / POST pages from/to lagged server. What is a best way to communicate with the lagged server? Make for example 10 parallel requests or make one request with some timeout or something else? In which language can i do this. I already wrote Shell script with CURL web client but the CURL lag all the time. Can you help me please with this issues.
Thanks a lot.

#2
so1i

so1i

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 312 posts
I'd say PHP.

#3
eth4rendil

eth4rendil

    Newbie

  • Members
  • Pip
  • 7 posts

so1i said:

I'd say PHP.

and what ist the best HTTP / HTTPS client in PHP to do this? I have already tried PHPWebHacks and PHPcurl...

#4
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
I would probably use curl multi if I were to do many fetches at a time...
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#5
eth4rendil

eth4rendil

    Newbie

  • Members
  • Pip
  • 7 posts

Orjan said:

I would probably use curl multi if I were to do many fetches at a time...

Hi Orjan,

thank for your advice. Could you link me example code how to use "curl multi" to post or get?

#6
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
you use the curl_multi_init function to init it, and then add curl handles to this multi handle
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#7
eth4rendil

eth4rendil

    Newbie

  • Members
  • Pip
  • 7 posts
i have found this fine example:
phpied.com/simultaneuos-http-requests-in-php-with-curl

But i don't think that this work realy simultaneous.

I did one test:
fist i started this simple test shell script on my server. This script run 20 simultaneous requests:

#!/bin/bash


browser="Mozilla/5.0 (Windows; U; Windows NT 6.1; sk; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)"

docasny=0


while (( $docasny < 20 )); do

curl -Ls -A "$browser" testpage >>temp &

((docasny++))

done

in the apache log files were all requests in one second.

After i started the PHP code what i found.
Request in this case were in range 1-3 seconds.....

According this test i think that curl multi requests are not the best way to do this or is the php code what i foud wrong?

#8
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
Well, you can't do anything at simultaneous really, everything actually needs to be started one after another, but the thing is that it throws away x requests in a row, than awaits answer on all of them and when all results are in, it returns them all to you.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall