Re: help with cURL + PHP

Stephen Pynenburg <[email protected]> Mon, 3 Nov 2014 21:20:31 -0500
Newsgroups gmane.comp.web.curl.php
Message-ID <CAPgVXYPomZgOKU=hr__Nd+KK7nUz7OZ0frqkEbREjrPsEGX+Mw@mail.gmail.com>
--===============2003049063==
Content-Type: multipart/alternative; boundary=047d7b3a80ee83eb540506ff1b97

--047d7b3a80ee83eb540506ff1b97
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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=C5=A1ite varnostno kodo v spodnje vnosno polje (velikost =
=C4=8Drk se
ne upo=C5=A1teva)."
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 <[email protected]>
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 you=
r
> example looks like this is not possible for remote forms.
>
>
>
> My code now looks like: <?php $ch =3D curl_init("
> https://raz.zav-zdruzenje.si/infocenter/Search.aspx"); curl_setopt($ch,
> CURLOPT_POSTFIELDS,
> array('ctl00$ICContentPlaceHolder$dBoxFrom'=3D>"24.10.2014",
> 'ctl00$ICContentPlaceHolder$tbVehicleRegistrationNumber'=3D>'LJ FF 350'))=
;
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult =3D curl_exec($c=
h);
> 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
>
>

--047d7b3a80ee83eb540506ff1b97
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><div>I think your problem is with the web site a=
nd not with cURL (there is nothing really wrong with your code as it is).<b=
r></div>I can&#39;t read Slovenian, but it looks like below where it says:<=
br>&quot;<span id=3D"ctl00_ICContentPlaceHolder_lblCaptcha">Prosimo, prepi=
=C5=A1ite varnostno kodo v spodnje vnosno polje (velikost =C4=8Drk se ne up=
o=C5=A1teva).&quot;<br></span></div><span id=3D"ctl00_ICContentPlaceHolder_=
lblCaptcha">It is asking you to input a CAPTCHA/verification code. This kin=
d of measure, unfortunately, is designed to prevent exactly what you&#39;re=
 trying to do.<br><br></span></div><span id=3D"ctl00_ICContentPlaceHolder_l=
blCaptcha">Stephen<br></span></div><div class=3D"gmail_extra"><br><div clas=
s=3D"gmail_quote">On Mon, Nov 3, 2014 at 5:30 PM, Mladen Jovic <span dir=3D=
"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">mla=
[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_q=
uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e=
x">


<div><div dir=3D"ltr"><p style=3D"white-space:pre-wrap;color:rgb(20,24,35);=
font-family:Helvetica,Arial,&#39;lucida grande&#39;,tahoma,verdana,arial,sa=
ns-serif;font-size:13px;line-height:17.9400005340576px;background-color:rgb=
(255,255,255)">Hello,</p><p style=3D"margin-top:10px;white-space:pre-wrap;c=
olor:rgb(20,24,35);font-family:Helvetica,Arial,&#39;lucida grande&#39;,taho=
ma,verdana,arial,sans-serif;font-size:13px;line-height:17.9400005340576px;b=
ackground-color:rgb(255,255,255)">i saw this example code for cURL on:
<a href=3D"http://curl.haxx.se/libcurl/php/examples/httpfileupload.html" re=
l=3D"nofollow" style=3D"color:rgb(59,89,152);text-decoration:none" target=
=3D"_blank">http://curl.haxx.se/libcurl/php/examples/httpfileupload.html</a=
></p><p style=3D"margin-top:10px;white-space:pre-wrap;color:rgb(20,24,35);f=
ont-family:Helvetica,Arial,&#39;lucida grande&#39;,tahoma,verdana,arial,san=
s-serif;font-size:13px;line-height:17.9400005340576px;background-color:rgb(=
255,255,255)">i want to ask you if you can help me how i can use this for r=
emote forms? </p><p style=3D"margin-top:10px;white-space:pre-wrap;color:rgb=
(20,24,35);font-family:Helvetica,Arial,&#39;lucida grande&#39;,tahoma,verda=
na,arial,sans-serif;font-size:13px;line-height:17.9400005340576px;backgroun=
d-color:rgb(255,255,255)"><br></p><p style=3D"margin-top:10px;white-space:p=
re-wrap;color:rgb(20,24,35);font-family:Helvetica,Arial,&#39;lucida grande&=
#39;,tahoma,verdana,arial,sans-serif;font-size:13px;line-height:17.94000053=
40576px;background-color:rgb(255,255,255)">For example:
<a href=3D"https://raz.zav-zdruzenje.si/infocenter/Search.aspx" rel=3D"nofo=
llow" style=3D"color:rgb(59,89,152);text-decoration:none" target=3D"_blank"=
>https://raz.zav-zdruzenje.si/infocenter/Search.aspx</a></p><p style=3D"mar=
gin-top:10px;white-space:pre-wrap;color:rgb(20,24,35);font-family:Helvetica=
,Arial,&#39;lucida grande&#39;,tahoma,verdana,arial,sans-serif;font-size:13=
px;line-height:17.9400005340576px;background-color:rgb(255,255,255)">in thi=
s form i would like to fill up first and second input, but with your exampl=
e looks like this is not possible for remote forms.</p><p style=3D"margin-t=
op:10px;white-space:pre-wrap;color:rgb(20,24,35);font-family:Helvetica,Aria=
l,&#39;lucida grande&#39;,tahoma,verdana,arial,sans-serif;font-size:13px;li=
ne-height:17.9400005340576px;background-color:rgb(255,255,255)"><br></p><p =
style=3D"margin-top:10px;white-space:pre-wrap;color:rgb(20,24,35);font-fami=
ly:Helvetica,Arial,&#39;lucida grande&#39;,tahoma,verdana,arial,sans-serif;=
font-size:13px;line-height:17.9400005340576px;background-color:rgb(255,255,=
255)"><br></p><p style=3D"margin-top:10px;white-space:pre-wrap;color:rgb(20=
,24,35);font-family:Helvetica,Arial,&#39;lucida grande&#39;,tahoma,verdana,=
arial,sans-serif;font-size:13px;line-height:17.9400005340576px;background-c=
olor:rgb(255,255,255)">My code now looks like:
&lt;?php
   $ch =3D curl_init(&quot;<a href=3D"https://raz.zav-zdruzenje.si/infocent=
er/Search.aspx" rel=3D"nofollow" style=3D"color:rgb(59,89,152);text-decorat=
ion:none" target=3D"_blank">https://raz.zav-zdruzenje.si/infocenter/Search.=
aspx</a>&quot;); =20
   curl_setopt($ch, CURLOPT_POSTFIELDS,
               array(&#39;ctl00$ICContentPlaceHolder$dBoxFrom&#39;=3D&gt;&q=
uot;24.10.2014&quot;,
                     &#39;ctl00$ICContentPlaceHolder$tbVehicleRegistrationN=
umber&#39;=3D&gt;&#39;LJ FF 350&#39;));
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   $postResult =3D curl_exec($ch);
   curl_close($ch);
   print &quot;$postResult&quot;;</p><p style=3D"margin-top:10px;white-spac=
e:pre-wrap;color:rgb(20,24,35);font-family:Helvetica,Arial,&#39;lucida gran=
de&#39;,tahoma,verdana,arial,sans-serif;font-size:13px;line-height:17.94000=
05340576px;background-color:rgb(255,255,255)">?&gt;</p><p style=3D"margin-t=
op:10px;white-space:pre-wrap;color:rgb(20,24,35);font-family:Helvetica,Aria=
l,&#39;lucida grande&#39;,tahoma,verdana,arial,sans-serif;font-size:13px;li=
ne-height:17.9400005340576px;background-color:rgb(255,255,255)">but no succ=
ess with this code for now <span title=3D":(" style=3D"width:16px;min-heigh=
t:16px;display:inline-block;vertical-align:top;background-image:url(https:/=
/fbstatic-a.akamaihd.net/rsrc.php/v2/yP/r/90b8T5aM1AH.png);background-repea=
t:no-repeat"></span></p><p style=3D"margin-top:10px;white-space:pre-wrap;co=
lor:rgb(20,24,35);font-family:Helvetica,Arial,&#39;lucida grande&#39;,tahom=
a,verdana,arial,sans-serif;font-size:13px;line-height:17.9400005340576px;ba=
ckground-color:rgb(255,255,255)"><br></p><p style=3D"margin-top:10px;white-=
space:pre-wrap;color:rgb(20,24,35);font-family:Helvetica,Arial,&#39;lucida =
grande&#39;,tahoma,verdana,arial,sans-serif;font-size:13px;line-height:17.9=
400005340576px;background-color:rgb(255,255,255)">i hope you will have time=
 to help me with this, cuz i spent almost 5hours with no success <span titl=
e=3D":)" style=3D"width:16px;min-height:16px;display:inline-block;vertical-=
align:top;background-image:url(https://fbstatic-a.akamaihd.net/rsrc.php/v2/=
yP/r/90b8T5aM1AH.png);background-repeat:no-repeat"></span></p><p style=3D"m=
argin-top:10px;white-space:pre-wrap;color:rgb(20,24,35);font-family:Helveti=
ca,Arial,&#39;lucida grande&#39;,tahoma,verdana,arial,sans-serif;font-size:=
13px;line-height:17.9400005340576px;background-color:rgb(255,255,255)"><br>=
</p><p style=3D"margin-top:10px;white-space:pre-wrap;color:rgb(20,24,35);fo=
nt-family:Helvetica,Arial,&#39;lucida grande&#39;,tahoma,verdana,arial,sans=
-serif;font-size:13px;line-height:17.9400005340576px;background-color:rgb(2=
55,255,255)">P.S: I&#39;m not programer so i would like some help for begin=
ner :) I&#39;m sory if i didn&#39;t do something right, because i&#39;m usi=
ng first time mail lists.</p><p style=3D"margin-top:10px;white-space:pre-wr=
ap;color:rgb(20,24,35);font-family:Helvetica,Arial,&#39;lucida grande&#39;,=
tahoma,verdana,arial,sans-serif;font-size:13px;line-height:17.9400005340576=
px;background-color:rgb(255,255,255)"><br></p><p style=3D"margin-top:10px;w=
hite-space:pre-wrap;color:rgb(20,24,35);font-family:Helvetica,Arial,&#39;lu=
cida grande&#39;,tahoma,verdana,arial,sans-serif;font-size:13px;line-height=
:17.9400005340576px;background-color:rgb(255,255,255)"><br></p><p style=3D"=
margin-top:10px;white-space:pre-wrap;color:rgb(20,24,35);font-family:Helvet=
ica,Arial,&#39;lucida grande&#39;,tahoma,verdana,arial,sans-serif;font-size=
:13px;line-height:17.9400005340576px;background-color:rgb(255,255,255)">Tha=
nks, Mladen</p> 		 	   		  </div></div>
<br>_______________________________________________<br>
<a href=3D"http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php" targe=
t=3D"_blank">http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php</a><=
br>
<br></blockquote></div><br></div>

--047d7b3a80ee83eb540506ff1b97--

--===============2003049063==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KaHR0cDovL2Nv
b2wuaGF4eC5zZS9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vY3VybC1hbmQtcGhwCg==

--===============2003049063==--