Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > perl curl get data from website

Reply
Thread Tools

perl curl get data from website

 
 
SVCitian
Guest
Posts: n/a
 
      10-16-2010
These 3 URLs work on a browser.. and return the same results... both
Firefox and IE.

But, I want to retrieve this programmatically using curl or perl..
with the prefix and sn serial number changed each time... How can i
make it work..

Can you provide a simple curl command line .. or perl get http.. to
demonstrate the retrieval.. thanks.


http://www.bangkokflightservices.com...h=%A0%A0%A0%A0

http://www.bangkokflightservices.com...=HWB&h_sn=&ch=

http://www.bangkokflightservices.com...efix=HWB&h_sn=

 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      10-16-2010
SVCitian <(E-Mail Removed)> wrote:
>These 3 URLs work on a browser.. and return the same results... both
>Firefox and IE.
>
>But, I want to retrieve this programmatically using curl or perl..
>with the prefix and sn serial number changed each time... How can i
>make it work..
>
>Can you provide a simple curl command line .. or perl get http.. to
>demonstrate the retrieval.. thanks.


See the FAQ: perldoc -q "HTML file"
"How do I fetch an HTML file?"

jue
 
Reply With Quote
 
 
 
 
SVCitian
Guest
Posts: n/a
 
      10-17-2010
On Oct 16, 9:28*pm, Jürgen Exner <(E-Mail Removed)> wrote:
> SVCitian <(E-Mail Removed)> wrote:
> >These 3 URLs work on a browser.. and return the same results... both
> >Firefox and IE.

>
> >But, I want to retrieve this programmatically using curl or perl..
> >with the prefix and sn serial number changed each time... How can i
> >make it work..

>
> >Can you provide a simple curl command line .. or perl get http.. to
> >demonstrate the retrieval.. thanks.

>
> See the FAQ: perldoc -q "HTML file"
> * * * * "How do I fetch an HTML file?"
>
> jue


Actually i know how to use curl with in perl or use perl html
commands.

But, the problem is the above URL doesn't work even in the simplest
case of:

curl "http://www.google.com/url?sa=D&q=http://
www.bangkokflightservices.com/our_cargo_track%26trace.php%3Fm_prefix%3D176%26m_s n%3D75064953%26h_prefix%3DHWB%26h_sn%3D&usg=AFQjCN Fh02ikp7CSs9lxi_S7ec0Edw9m5g"

I even tried to user "tamper data" firefox add to get behind the
scenes of GET, POST, etc... but I can't proceed any further than the
URLs given above.

why? that may be something to do with ajax, cookie, user agent, or
whatever. I have tried some combinations, but none works.

It works on the browser just right out of the box.. even changing the
prefix and serial numbers.

So, i want to find out what i am missing that hinders the data
retrieval.

 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      10-17-2010
SVCitian <(E-Mail Removed)> wrote:
>But, the problem is the above URL doesn't work even in the simplest
>case of:
>
>curl "http://www.google.com/url?sa=D&q=http://
>www.bangkokflightservices.com/our_cargo_track%26trace.php%3Fm_prefix%3D176%26m_s n%3D75064953%26h_prefix%3DHWB%26h_sn%3D&usg=AFQjCN Fh02ikp7CSs9lxi_S7ec0Edw9m5g"
>
>I even tried to user "tamper data" firefox add to get behind the
>scenes of GET, POST, etc... but I can't proceed any further than the
>URLs given above.


An HTTP request using that URL above returns

<!-- This page yong codeing. Please don't copy idea or code before owne
argee. if you copy this code than see it's you code and you project. you
is ****ing man -->
<script> window.open
('http://www.bangkokflightservices.com/our_cargo_track.php') ;
setTimeout("window.close();", 10);
</script>

Were you expecting something different?

>It works on the browser just right out of the box.. even changing the
>prefix and serial numbers.


Please define "works"/"doesn't work".
I am getting just a blank page (FireFox 3.6.8; yeah, I am going to
update now) which is not surprising given the HTTP response above.

To me that is "doesn't work", but of course YMMV.

>So, i want to find out what i am missing that hinders the data
>retrieval.


Are you getting something different from your script?

jue
 
Reply With Quote
 
SVCitian
Guest
Posts: n/a
 
      10-17-2010
On Oct 17, 11:56*am, Jürgen Exner <(E-Mail Removed)> wrote:
> SVCitian <(E-Mail Removed)> wrote:
> >But, the problem is the above URL doesn't work even in the simplest
> >case of:

>
> >curl "http://www.google.com/url?sa=D&q=http://
> >www.bangkokflightservices.com/our_cargo_track%26trace.php%3Fm_prefix%..."

>
> >I even tried to user "tamper data" firefox add to get behind the
> >scenes of GET, POST, etc... but I can't proceed any further than the
> >URLs given above.

>
> An HTTP request using that URL above returns
>
> <!-- *This page yong codeing. Please don't copy idea or code before owne
> argee. if you copy this code than see it's you code and you project. you
> is ****ing man *-->
> * * * * * * * * <script> window.open
> ('http://www.bangkokflightservices.com/our_cargo_track.php') ;
> * * * * * * * * * * * * setTimeout("window.close();", 10);
> * * * * * * * * </script>
>
> Were you expecting something different?
>
> >It works on the browser just right out of the box.. even changing the
> >prefix and serial numbers.

>
> Please define "works"/"doesn't work".
> I am getting just a blank page (FireFox 3.6.8; yeah, I am going to
> update now) which is not surprising given the HTTP response above.
>
> To me that is "doesn't work", but of course YMMV.
>
> >So, i want to find out what i am missing that hinders the data
> >retrieval.

>
> Are you getting something different from your script?
>
> jue


i am afraid we are not having the same response in our browsers.. due
to cookies or whatever.
Please try this,
shortened version: http://goo.gl/FlGU
full version:
http://www.google.com/url?sa=D&q=htt...gV1qdOWYyp-gkg

what you expect to see is:
about 7 lines of some transaction records from 14/10/2010 05:37pm to
09:54pm.. if you don't get this result in your end then you will have
to start from scratch.. then i suggest you go to the

Homepage: http://www.bangkokflightservices.com...argo_track.php

and put 176 - 75064953 in MAWB suffix and prefix and click "Search"


I want to get the exact same results of the resulting page through
curl or perl http.

It doesn't work for me.. when I put the above URL (this is how far I
have reached).. using
curl "... above url..."
but, it works for me in firefox with the same URL.

Let me know if you need more clarification.


Yes.. it returns this in some occasions... but this is not what i
expect.. i expect about 7 lines of transaction records. You will know
what I mean when you start from scratch with the URL above and put
prefix and suffix yourselves.

<!-- This page yong codeing. Please don't copy idea or code before
owne
argee. if you copy this code than see it's you code and you project.
you
is ****ing man -->


Thanks.
 
Reply With Quote
 
Ilya Zakharevich
Guest
Posts: n/a
 
      10-17-2010
On 2010-10-17, Tad McClellan <(E-Mail Removed)> wrote:
> You might want to try it with the Web Scraping Proxy:
>
> http://www2.research.att.com/sw/tools/wsp/
>
> which is nice because it logs the traffic in the form of
> Perl code that you can copy/paste/modify to suit your needs.


A username and password are being requested by
http://www2.research.att.com. The site says: "Enter Password"

Now what?
Ilya
 
Reply With Quote
 
Ilya Zakharevich
Guest
Posts: n/a
 
      10-17-2010
On 2010-10-17, Tad McClellan <(E-Mail Removed)> wrote:
>> A username and password are being requested by
>> http://www2.research.att.com. The site says: "Enter Password"


>> Now what?


> Don't overlook the BOLD text on the page I linked to.
>
> It's easy to do, I overlooked it at first too


A wonderful example of steganography. And very well balanced - if it
were 4 times longer, I would run a "Search" on the page...

Thanks,
Ilya
 
Reply With Quote
 
SVCitian
Guest
Posts: n/a
 
      10-18-2010
On Oct 17, 10:21*pm, Tad McClellan <(E-Mail Removed)> wrote:
> SVCitian <(E-Mail Removed)> wrote:
> > I even tried to user "tamper data" firefox add to get behind the
> > scenes of GET, POST, etc... but I can't proceed any further than the
> > URLs given above.

>
> > why? that may be something to do with ajax, cookie, user agent, or
> > whatever.

>
> You might want to try it with the Web Scraping Proxy:
>
> * *http://www2.research.att.com/sw/tools/wsp/
>
> which is nice because it logs the traffic in the form of
> Perl code that you can copy/paste/modify to suit your needs.
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
> The above message is a Usenet post.
> I don't recall having given anyone permission to use it on a Web site.


I have tried this long time back, and I couldn't make it work and also
failed with the attempt.

This in itself generated a whole search in forums for making it work.

If anyone out there who has used wsp (and still have it on their
computers), could you run my site through it and advise your findings.
I think it just takes few minutes of your time if you have already
made the wsp work for you.

Will appreciate your assistance.

Thank you.


 
Reply With Quote
 
sln@netherlands.com
Guest
Posts: n/a
 
      10-18-2010
On Mon, 18 Oct 2010 05:58:42 -0700 (PDT), SVCitian <(E-Mail Removed)> wrote:

>On Oct 17, 10:21*pm, Tad McClellan <(E-Mail Removed)> wrote:
>> SVCitian <(E-Mail Removed)> wrote:
>> > I even tried to user "tamper data" firefox add to get behind the
>> > scenes of GET, POST, etc... but I can't proceed any further than the
>> > URLs given above.

>>
>> > why? that may be something to do with ajax, cookie, user agent, or
>> > whatever.

>>
>> You might want to try it with the Web Scraping Proxy:
>>
>> * *http://www2.research.att.com/sw/tools/wsp/
>>
>> which is nice because it logs the traffic in the form of
>> Perl code that you can copy/paste/modify to suit your needs.
>>
>> --
>> Tad McClellan
>> email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
>> The above message is a Usenet post.
>> I don't recall having given anyone permission to use it on a Web site.

>
>I have tried this long time back, and I couldn't make it work and also
>failed with the attempt.
>
>This in itself generated a whole search in forums for making it work.
>
>If anyone out there who has used wsp (and still have it on their
>computers), could you run my site through it and advise your findings.
>I think it just takes few minutes of your time if you have already
>made the wsp work for you.
>
>Will appreciate your assistance.
>
>Thank you.
>


I think the key to using a buggy wsp.pl is to install openssl. Even then,
its buggy as there's so much dependency on browser settings and caches.
Might have to use a seperate machine for the proxy. I used it locally 127.0.0.1
and enabled browser lowest security/privacy, disabled all advanced options.
Still buggy, have to end process in task manager.

After disabling everything in advanced options in IE6 (it had problems with
png file downloads), this was captured with obtuse line breaks and possible
unknown encoding (probably utf-.

I'm sure this won't help.

-sln

--- Proxy server running on rcx port: 5364

# Request:
http://www.bangkokflightservices.com...prefix=176&m_s
n=75064953&h_prefix=HWB&h_sn=&ecy=e076438db64c6190 f7b9689a379b7f7093368f1652d14d
b65fee1ab916713f3f5f4030f53369cb1f669614312c474889 9c272f4d976a2b299274a21ad80fc0
72b1bab2ab1c181d08c670188722e51ec162f9ae337e3f2f13 2c88d249133815558d241ce8a4e9b3
fa75c144268b9e901037c2c7257142ee42ff9b2bf2767f57ed 62b94fd938ea4dd2b28c53fea6af74
be&ch=%A0%A0%A0%A0
# Cookie (NO Set-Cookie): 'PHPSESSID', '1831c0a805050e73bff5a54e0fa017d5
'
$request = new HTTP::Request('GET' =>
"http://www.bangkokflightservices.com/TrackTrace/showc_track.php?m_prefix=176&m_
sn=75064953&h_prefix=HWB&h_sn=&ecy=e076438db64c619 0f7b9689a379b7f7093368f1652d14
db65fee1ab916713f3f5f4030f53369cb1f669614312c47488 99c272f4d976a2b299274a21ad80fc
072b1bab2ab1c181d08c670188722e51ec162f9ae337e3f2f1 32c88d249133815558d241ce8a4e9b
3fa75c144268b9e901037c2c7257142ee42ff9b2bf2767f57e d62b94fd938ea4dd2b28c53fea6af7
4be&ch=%A0%A0%A0%A0");
# Table 1: 11 rows; table nesting: 5
# Saving web page as w4

# Request:
http://www.bangkokflightservices.com...refix=176&m_sn
=75064953&h_prefix=HWB&h_sn=&ch= &id=0.015485021941311072
# Referer:
http://www.bangkokflightservices.com...prefix=176&m_s
n=75064953&h_prefix=HWB&h_sn=&ecy=e076438db64c6190 f7b9689a379b7f7093368f1652d14d
b65fee1ab916713f3f5f4030f53369cb1f669614312c474889 9c272f4d976a2b299274a21ad80fc0
72b1bab2ab1c181d08c670188722e51ec162f9ae337e3f2f13 2c88d249133815558d241ce8a4e9b3
fa75c144268b9e901037c2c7257142ee42ff9b2bf2767f57ed 62b94fd938ea4dd2b28c53fea6af74
be&ch=%A0%A0%A0%A0
# Cookie: 'PHPSESSID', '1831c0a805050e73bff5a54e0fa017d5
'
$request = new HTTP::Request('GET' =>
"http://www.bangkokflightservices.com/TrackTrace/search_awb.php?m_prefix=176&m_s
n=75064953&h_prefix=HWB&h_sn=&ch= &id=0.015485021941311072");
# Table 1: 5 rows
# Table 2: 9 rows
# Saving web page as w5


 
Reply With Quote
 
SVCitian
Guest
Posts: n/a
 
      10-19-2010
On Oct 19, 2:26*am, (E-Mail Removed) wrote:
> On Mon, 18 Oct 2010 05:58:42 -0700 (PDT),SVCitian<(E-Mail Removed)> wrote:
> >On Oct 17, 10:21*pm, Tad McClellan <(E-Mail Removed)> wrote:
> >>SVCitian<(E-Mail Removed)> wrote:
> >> > I even tried to user "tamper data" firefox add to get behind the
> >> > scenes of GET, POST, etc... but I can't proceed any further than the
> >> > URLs given above.


I have no clue of how to make heads or tails of the result.

If you could post the result in a more helpful format.. I would
appreciate it.

Thanks.
 
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
Page Curl Javascript wtd ß Ø ® G HTML 10 06-07-2007 09:34 PM
post data using curl elrondrules@gmail.com Python 0 02-12-2007 06:48 PM
Curl/Perl http post performanc issue wkhedr Perl Misc 3 08-03-2006 05:01 PM
Extract data using Curl Unix Command & Perl Script from Webpage Fiaz Idris Perl Misc 13 03-17-2005 09:19 AM
cURL in ASP.NET Chris ASP .Net 1 12-19-2004 04:59 PM



Advertisments