cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: help with cURL + PHP

From: Scott Battersby <scott_at_stopthatsnoring.com.au>
Date: Tue, 4 Nov 2014 19:01:10 +1030

I think the problem is more fundamental. cURL isn't useful for
filling in forms. What cURL could do for you is to simulate sending
("POSTing") a completed form to the form target... ie simulate what
happens after a human fills in the fields and then clicks the "Isci"
button. You can read about the POST process here... it's a
fundamental part of the internet :
http://en.wikipedia.org/wiki/POST_(HTTP)

So, can we do this with cURL in your application? Turns out to be
pretty hard... it's not just a "normal" POST.

If you examine the page source at
https://raz.zav-zdruzenje.si/infocenter/Search.aspx you'll see that
clicking the Isci button runs some javascript.... so you could dig
into that javascript and see how it works, then simulate THAT with
cURL. The javascript most likely carries out a POST, and probably
some other processing... so you'd have to simulate the other
processing in PHP and then do the POST with cURL. Of course you'd
also need to get the captcha solved somehow... perhaps with a service
like http://www.deathbycaptcha.com/

An alternative approach, if you are happy to solve the captcha
yourself and just want to save time filling in the other fields is to
use a windows machine and control Internet Explorer through vb or vba.
Here's a rough example to get you started :
http://www.excely.com/excel-vba/ie-automation.shtml

Good luck :)

Scott

On 4 November 2014 17:44, Mladen Jovic <mladen.jovic_at_hotmail.com> wrote:
> Hmm, thanks for your answer.
>
> I'm not sure if i was clear enought. My idea was to put data in first and
> second input, and then manually write captcha and manually submit the form.
>
> Br Mladen
>
>
> -------- Original message --------
> From: Stephen Pynenburg <spynenburg_at_gmail.com>
> Date:04/11/2014 07:32 (GMT+01:00)
> To: curl with PHP <curl-and-php_at_cool.haxx.se>
> Cc:
> Subject: Re: help with cURL + PHP
>
> I think your problem is with the web site and not with cURL (there is
> nothing really wrong with your code as it is).
> I can't read Slovenian, but it looks like below where it says:
> "Prosimo, prepišite varnostno kodo v spodnje vnosno polje (velikost črk se
> ne upošteva)."
> It is asking you to input a CAPTCHA/verification code. This kind of measure,
> unfortunately, is designed to prevent exactly what you're trying to do.
>
> Stephen
>
> On Mon, Nov 3, 2014 at 5:30 PM, Mladen Jovic <mladen.jovic_at_hotmail.com>
> wrote:
>
> Hello,
>
> i saw this example code for cURL on:
> http://curl.haxx.se/libcurl/php/examples/httpfileupload.html
>
> i want to ask you if you can help me how i can use this for remote forms?
>
>
> For example: https://raz.zav-zdruzenje.si/infocenter/Search.aspx
>
> in this form i would like to fill up first and second input, but with your
> example looks like this is not possible for remote forms.
>
>
>
> My code now looks like: <?php $ch =
> curl_init("https://raz.zav-zdruzenje.si/infocenter/Search.aspx");
> curl_setopt($ch, CURLOPT_POSTFIELDS,
> array('ctl00$ICContentPlaceHolder$dBoxFrom'=>"24.10.2014",
> 'ctl00$ICContentPlaceHolder$tbVehicleRegistrationNumber'=>'LJ FF 350'));
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult = curl_exec($ch);
> curl_close($ch); print "$postResult";
>
> ?>
>
> but no success with this code for now
>
>
> i hope you will have time to help me with this, cuz i spent almost 5hours
> with no success
>
>
> P.S: I'm not programer so i would like some help for beginner :) I'm sory if
> i didn't do something right, because i'm using first time mail lists.
>
>
>
> Thanks, Mladen
>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2014-11-04