Find the answer to your Linux question:
Results 1 to 3 of 3
good day dear Linux-experts well i have some isseues here: i run a tiny little script with perl Mechanize :: Firefox i want to do the job with php-Curl - ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    May 2013
    Posts
    263

    PHP /Curl rewrite of a Perl-mechanize script


    good day dear Linux-experts


    well i have some isseues here: i run a tiny little script with perl Mechanize :: Firefox

    i want to do the job with php-Curl -


    PHP Code:
    #!/usr/bin/perl
    use strict;
    use 
    warnings;

    use 
    WWW::Mechanize::Firefox;

    my @urls qw(
        
    http://www.google.com
        
    http://www.yahoo.com
        
    http://www.cnn.com
        
    http://www.bing.com
        
    http://www.nbcnews.com
    );

    my $temp '/tmp';
    my $mech WWW::Mechanize::Firefox->new('create');

    foreach 
    my $url (@urls){
        
    my ($name) = $url =~ /www\.(\w+)\.com/;
        print 
    "creating $name.png\n";
         
        
    $mech->get($url);
        
    sleep(5);
        
    my $png $mech->content_as_png(undefundef, {width => 240height => 240});
        
        
    my $file "$temp/$name".".png";
        
    open my $fh">"$file or die "couldnt create $file";
        
    binmode $fh;
        print 
    $fh $png;
        
    close $fh;
    }

    print 
    "done\n"
    is this doable - can i do this with php / curl and - this would be great
    with mozrepl.
    Mozrepl is very very important since it renders the images.

  2. #2
    Just Joined!
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    36
    Anything PERL can do , PHP can do and with or without CURL.
    PHP also has image handling functions.
    Presumeably you just want the CURL for TELNET.

  3. #3
    Linux User
    Join Date
    May 2013
    Posts
    263
    hello dear nicephotog

    many many thanks

    Quote Originally Posted by nicephotog View Post
    Anything PERL can do , PHP can do and with or without CURL.
    PHP also has image handling functions.
    Presumeably you just want the CURL for TELNET.

    sure thing - PHP is very powerful. I think with Curl we have some great options that are somewhat more that

    file_get_content
    or things alike that.

    but youre right - we have very very powerful PHP options - with / without CURL

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •