NYCPHP Meetup

NYPHP.org

[nycphp-talk] Mantis/Subversion integration

Mark Withington mwithington at PLMresearch.com
Thu Sep 15 16:05:15 EDT 2005


To paraphrase Homer Simpson, "Doh!"  
 
PHP's CLI, brilliant.  Thanks Greg.
 
 

--------------------------
Mark L. Withington
PLMresearch
v: 508-746-2383
m: 508-801-0181
Calendar: http://www.plmresearch.com/calendar.php
<http://www.plmresearch.com/calendar.php> 




-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Greg Rundlett
Sent: Thursday, September 15, 2005 3:53 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Mantis/Subversion integration




On 9/15/05, Greg Rundlett <greg.rundlett at gmail.com
<mailto:greg.rundlett at gmail.com> > wrote: 

quick and easy


function openUrl($url) {
       

// Fake the browser type
       // ini_set('user_agent','MSIE 4\.0b2;');
    $handle = 

fopen($url
, "rb"

);
    $contents = '';
    if

($handle) {
        while 

(!feof(
$handle)) {
            

$contents .= fread($handle


, 8192);
        }
        fclose(

$handle);       
    }
    else {
        

$contents = 'Error opening $url' . $url
;
    }
    

return $contents;
} 


print $contents = openUrl('http://www.google.com')
<http://www.google.com%27%29> ;



and run that from the bat as php.exe -f myUrlGetter.php
url=http://www.foo.com <http://www.foo.com> 

of course then you'd perhaps want to add in Console/GetOpt.php (from PEAR)
to parse the command-line args 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20050915/ca5afcf0/attachment.html>


More information about the talk mailing list