HomeHome Flag of the Danes Flag of the United States of America
home
cURL Journal
Using cURL to make the world go around at danallen.com

October 25, 2009

By Dan Allen



Fake IT People, you can tell by their spiffiness. Even though they are fake, the large white board and
relaxed atmosphere are crucial to the best IT work.


Thanks to cURL, the Earth is turning again. I am grateful and relieved.

spinning Earth real time

Also thanks to cURL, the webcams are on at danallen.com. To see the latest soon to be defunct programmers work area, click here. Thank you

Here is the code for how the Earth gets spinning:




$dogTargetPage = 'http://www.fourmilab.ch/cgi-bin/Earth?imgsize=275&opt=-l&lat=55.0&ns=North&lon=60&ew=West&alt=30000&img=learth.evif';

// create curl resource
$ch = curl_init();

// set url
curl_setopt($ch, CURLOPT_URL, $dogTargetPage);

//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// $output contains the output string
$output = curl_exec($ch);

// close curl resource to free up system resources
curl_close($ch);


$dogSniffNose = strpos($output,'img src="/cgi-bin/Earth?di=');
$dogPicAddressStart = $dogSniffNose + 27;
$dogSniffTail = strpos($output,'"', $dogPicAddressStart);
$dogPicAddressEnd = $dogSniffTail;
$dogPicAddressLength = $dogPicAddressEnd - $dogPicAddressStart;
$dogPicHash = substr($output,$dogPicAddressStart,$dogPicAddressLength);
$dogPicURL = 'http://www.fourmilab.ch/cgi-bin/Earth?di=' . $dogPicHash;
?>



Next steps:

  1. Fix webcams that run with the spinning Earth at danallen.com DONE
  2. Replace live image link from danallen.com with cron job that saves updated pic once per 15 minutes. DONE
  3. Save those 15-minute pics for a year
  4. Use pics from file instead of Swiss Observatory, to achieve spin independence
  5. Be happy for being a step closer to fulfilling a dream

  6. October 2009
    The basic idea is to use cURL to read a webpage at the Swiss Earth Observatory, looking for the address of the earth image (sample), saving that address to a php variable that can then be used to display the latest live image on my website.

    To see what CURL is going to do, surf over to the Swiss Earth Observatory. When you get there, right click in the white area of the page, and select VIEW SOURCE. This will display the web page code sent to your browser. The browser translates this code on your computer into the web page you see. The picture of Earth at that page has an address that always changes. To see what it is now, scan down the screen displayed by view source until you find
    <img src="/cgi-bin/Earth?di=
    After the di=, there will be a long string of letters and numbers, that look something like this.
    E9B2DF0EAA864 48B20D6AB4ABD37D7605BB4A 684FEC0D8EB20EA5BAB710F335356 35B0DCF2B0D15E683658B6E75C4761D5C A004DFF5266CE5675B091
    That long string always changes. Curl can read the SOURCE for the web page, find the long string, and save it.

    Starting with an introduction from php.net
    Once you've compiled PHP with cURL support (comes with Linux hosting from Godaddy), you can begin using the cURL functions.

    The basic idea behind the cURL functions is that you initialize a cURL session using the curl_init(), then you can set all your options for the transfer via the curl_setopt(), then you can execute the session with the curl_exec() and then you finish off your session using the curl_close(). Here is an example that uses the cURL functions to fetch the example.com homepage into a file:
    $ch = curl_init("http://www.example.com/");
    $fp = fopen("example_homepage.txt", "w");

    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, 0);

    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
    ?>

    Please
    What do you think? This spot is open for you to write whatever you want. Thanks.

    The more often you post here, the better.
    no login required for anyone

     up to 2000 characters. Thank you for your contribution.
    Previous Comments. If you don't like them, replace them with yours! Thanks!
    Very nice site!

    Very nice site!

    Very nice site!

    Mission II Ranking
    as of: September 6, 2010 1:45 PM
      hits   score
    TwitterGun Goes Down with Twitter Basic Authentication 33   2,848
    TwitterGun Resurrection 1   1,411
    Goldman Rip Off of College Students 1   1,152
    Russian Policeman Blows Whistle through YouTube 17   456
    Panama Canal History Part 7 543   423
    Panama Canal History Part 6 807   337
    Proposals for Vermont 279   268
    First Time Riders 139   264
    Morality Is A Tool for Survival: Under Review 74   260
    On the Ground in Afghanistan 106   245
    cURL Journal 1,187   235
    The Solution 118   219
    Homeward Bound 153   212
    Vermont Yankee Might be Saved by Brian Dubie 778   212
    Suicide Letter 275   210
    More Lies Used to Dupe Americans Into Supporting the Surge 149   191
    Letter from Jes Kraus 119   190
    Hunger Strike 91   187
    Montpelier Base Camp Graced by Visiting Gentlemen 163   178
    Angry Old Man Picks Fight 107   173
    The New Serf 63   160
    War on Terror Through Muslim Eyes 125   155
    John Yoo to Avoid Prosecution 2,078   154
    Pearl Fashion 216   147
    Obama Is Not Enough 44   145
    Kidnapping Business in Iraq 175   141
    Iraqi Army Filled with Mahdi Soldiers 544   140
    Everest Digest News 102   139
    Green Zone Development Plans 155   139
    Weather Pattern for Last 400,000 Years 206   137
    Deacons of Deadwood - Riding on Montpelier, Vermont October 17, 2008 578   135
    How Goldman Sachs Capitalized Slack in Wheat Market 56   134
    American Poor Not Living Up to Their Name 142   127
    Panama Canal History Part 3 687   126
    American Economic Bubble Collapsing Fast 133   125
    Instead of Flying Into IRS Building 189   124
    Allen Expedition to Add Two Climbers 708   124
    Goldman Sachs Behind Food Shortages In 2008 67   123
    Week 2 19   122
    Geitner Pep Talk Fails 98   122
    Team UConn Called to Drop the Hammer 172   120
    Stephen Launches Grand Tour with Flight to Columbus, Ohio 147   119
    Panama Canal History Part 1 877   118
    Frequently Asked Questions (FAQ) 2,569   109
    Dan Allen Looking for the Zone 40   108
    Montpelier Websites Twitter 35   107
    Gemma to Marry Big Strong Man 109   107
    Yelling Woman Without Caulk Gun 101   106
    Speedway Just Getting Started 23   105
    Family Tree Extraction from Old Records 176   105
    Congratulations to Chinese Olympic Torch Team 104   104
    DNA Spelled Out In Detail for Each Person 120   103
    Honest Protection of Law Brings Weight of The Government Down on One Man and His Family 272   102
    US Torture Management 102   102
    Secure Forms on the Internet 189   101
    Dan Allen Roars! 59   100
    Developing Nations Allotted Less Carbon Per Capita 179   96
    Montpelier First Night 2009 3,330   93
    Panama Canal History Part 8 596   93
    Pilgrim Press 430   92
    Dan Allen Pushing His Team Up Mount Everest 1,362   91
    US Marines Take Down Fallujah 107   90
    New Training Looks Alive 27   89
    US Tax Amnesty 114   89
    January 20, 2010 6 pm Montpelier, VT
    Film: What Are We Doing Here?
    200   83
    Genetic Diversity Of European Americans 169   83
    Finally, Level Ground for Dan and Me 203   82
    MIT Education in Our Family 132   82
    Weather Charts 796   81
    Financial Collapse of 2009 101   80
    Team UConn Stampedes into Play 231   80
    Barcelona Rides Dan Allen into History 177   78
    Speedway Under Construction in Montpelier, Vermont 299   76
    Yelling At Me 41   76
    US War Criminals 211   76
    First Step to Summit: Why Are We Here? 95   76
    Happy Birthday Dad! 151   75
    Factory Work in China 148   75
    Luanne Davis 1971-2008 194   73
    Scary Thing About Fox News 116   71
    Give It To Me 62   71
    Death in Mount Everest Camp III 255   70
    Rio de Janeiro Cleaning Up to Host the World 79   70
    $9B US Cash Lost In Iraq 861   69
    Out Foxed 129   68
    Surrogate Mothering is Nothing Personal in India 134   67
    Limits on What DNA Can Tell Us 168   64
    Web Forms 40   64
    More Remedies for Bad Days 115   64
    Madoff Educating People on Stock Business 65   63
    Funding Stream Stopped 86   63
    Marshalling for Summer 243   63
    Anyone Can Get Rich With Science 166   63
    Blog Archive 528   62
    Unemployment Surprises Experts 25   62
    Bury My Heart at Wounded Knee 147   62
    Expert Eye Witness of US Occupation of Iraq 125   62
    Betzi and Andy are Heros Again! 190   61
    Personal websites 109   61
    Christmas Suggestions 104   60
    Ted Allen is 2007 Person of the Year 181   60
    Banking Families Show Their Respect for President Obama 131   59
    Terror Suspect List Yields Few Arrests 129   59
    Dan Allen Sitting Tight At Camp III 261   59
    3rd Graders Plan Military-Style Operation Against Teacher 248   58
    Global Warming 367   57
    Drug Addiction Pegged as Treatable Medical Problem 200   57
    Truth Revealed 100   56
    Summer Summit Drive on Mount Everest 187   56
    Petreaus and Bush Jiving Iraq 127   56
    US Economic Decline 156   55
    Dan Allens Twitter 29   54
    Survival Situation 266   54
    Panama Canal History Part 5 571   53
    First the MySQL Clock, Now the PHP Clock 31   53
    Najaf: Shiite Holy City 127   52
    Modern Hero 114   52
    Taser Games 217   52
    Bush: Supreme Commander of the Government 191   52
    Funny History 119   52
    Chinese Cabinet Official Takes Lethal Injection for Failure to Protect 684   51
    Corruption in Florida 116   51
    My Kent School Experience 162   51
    Obama Falling for Wall Street Con 124   51
    Daylight Savings Free Zone 525   51
    Dan Allen Settles into Camp 3 on Mount Everest 271   51
    Private Prison Service 157   50
    Patriot Act Becoming More Patriotic 120   50
    Stable Now? 81   50
    Harry Potter Ends 135   50
    Barre Granite Timeline 114   49
    U.S. Marines Handling Public Affairs After Haditha Incident 127   49
    Hippy Man Finds Best Man With Wife 179   48
    Battle of the Frigidus 122   48
    Decrees - Good and Under Review 183   48
    Living and Breathing Scat All the Time 139   48
    Balls Gone, Pain Stays 151   47
    Prime Time for Programming 66   47
    Luanne Davis Rides Horse on Mount Everest 275   47
    New Human Species Through Technology 119   47
    Joe Wilson and Nigerian Yellowcake 141   47
    Victory! Victory! Victory! 181   46
    My Dreams 114   46
    Hunger Strikes Work 129   46
    Dan Allen in G1 Endy Pit 26   46
    Only Problem Is Death 1,015   46
    Letter to NPR - You Were Snookered 115   45
    Oil Rules! 119   45
    Pearl Says She Always Is Right 132   45
    Montpelier Tweeter 35   45
    Scattered 133   45
    Paycheck to Paycheck Is Getting Harder 196   45
    War - Pacifists Not Patriotic 113   44
    Panama Canal Ripoff? 232   44
    Vermont Anti Billboard Law 246   44
    Base Camp Connection to Camp III Cut 157   44
    White and Nerdy 67   44
    Liberalism in Vermont 105   43
    Breaking Out of The Trap 215   43
    Clocks at the Speedway 64   43
    Eminem Understood 65   43
    Panama Canal History Part 2 252   43
    Niger Delta Oil 1,179   43
    Lunar Orbit 107   42
    DoubleDogMenuSnarl.php - No Leaks 57   42
    Purported Proof that Humans Cause Global Warming 118   42
    Silly Program 100   42
    Barcelona United Wins 3-2 98   42
    Beer Shotgun vs. Taser 241   42
    Tonight: PayPal Meets the Boss 46   42
    Link Queue 139   42
    Men 137   42
    Middle East War 109   42
    Battle Mythology 120   42
    Dan and Hector Stomping Down Snowmass 223   42
    Bush Torpedoed by His Own Party 104   42
    Running the Mob Is Good Work if You Can Get It 136   41
    Allen Men Atop Mount Everest 150   41
    Freedom and the Press 110   41
    Pre-Election Posturing 138   41
    Americans Targeted by FBI 129   41
    Court to Review Wiretapping 124   41
    Dan Allen Jr. Makes UConn Look Easy 203   41
    Iraq Assessment 92   41
    Happy Birthday Mom! 93   41
    Schedule Change for Summit Climb 176   41
    Clearing a Corner 99   41
    Grandparents and Suicide Both on The Same Day 118   40
    War Profiteer 101   40
    Michael Moore On Anti-Mainstream Media Tirade 128   40
    Cycling Wins a Victory for Humanity 125   40
    Team Sports 147   40
    Carts for Extending Meaningful Human Life by 50 Years 193   40
    Tuesday Night Racing 61   40
    US Healthcare Planning to Jettison Chronically Ill from Healthcare System 127   40
    Panama Canal History Part 4 584   40
    Reporter Finally Released from Guantanamo 159   40
    Survival Jobs 86   40
    Physics Cannot Find Life in the Universe 134   40
    President Bush Father & Son 129   40
    Brawndo, Public Service Announcement 106   40
    Sometimes, A Man Has Got to Do What He Has To Do 123   39
    Routine Gunshots in Jacksonville, Florida 175   39
    Great Moment in Supreme Court 109   39
    Forget the Guns, Just Fork Over the Money 29   39
    Obliterating a Mind 140   38
    DoubleDogMenuSnarl Sent Back to Dog House 34   38
    Old War Tactics Bioterrorism 119   38
    Iraqi Crime Courtesy Uncle Sam 155   38
    Documenting the Lee Line 212   38
    Withdrawing from Iraq 106   38
    Test Feed via Twitter 27   38
    Unbroken Agony: Haiti, From Revolution to the Kidnapping of a President 126   38
    No Communication Since May 1 126   37
    Alive Day 126   37
    Running Under Green In Montpelier 101   37
    Bush Butt 131   37
    Business Idea 20   37
    Tonic 111   36
    Hopefully this looks right in the headline 93   36
    Weapons Buildup In Iraq 118   36
    Constitution of the United States of America 159   36
    Economic Growth 154   36
    Blodgett Ovens Thrive in Vermont 416   36
    Dan Allen on Track for 3rd Straight British Open 125   35
    Torture Authorized by Justice Department in 2005 145   35
    Montpelier Life Waiting on Crystals 41   35
    Fox News in a Nutshell 92   35
    Bayeux Tapestry 107   35
    Army Officers Showing Brains 119   35
    New York City Considers Photography Permit 133   34
    Ceremony at India/Pakistan Border 128   34
    Internet Science Update 134   34
    Web Site Menu Code Sample 37   34
    In Iraq, Crazy Alliances With No Reasonable Hope for Success 139   34
    Bush Lawyers Under Legal Attack 117   34
    China Restricts Internet Video 113   34
    Common Interview Questions 92   34
    Monks Are Major Institution in Thailand 105   34
    Naked Stalker Comes To Life 116   34
    Vermont Government Worker News 32   33
    Peace with Islam 124   33
    Reviving Ophelia 126   33
    Ludwig Van Beethoven 117   33
    My Friends at Blackwater Security Consulting 104   33
    No News Today 139   32
    De-Spazzing the System 31   32
    Ancient Humor 111   32
    Michael 197   32
    Sunni Insurgents Stop Shooting in Exchange for Monthly Cash Flow 112   32
    Dan Allen "Never Play Again" 228   32
    Cockeyed Clocks in PHP and MySQL 39   31
    Dan Allen Running 170 MPH 53   31
    Dying in the Car 220   30
    Triage, The Brutal Act of Love and Service 153   30
    Bloggers Obligated to Promote Human Rights 193   30
    Psychologists As Witch Doctors for the CIA and DOD 190   29
    Beginner Every Day 180   29
    Remedy for a Bad Day 268   28
    Healthcare 60   28
    No Excuses, Period, Full Stop, End of Story 167   28
    Dan Allen Sets Camp at World Record 29,020 Feet 138   28
    Finding Your Crackberry 135   28
    War Profiteering through Tax Evasion 167   28
    Email from Kevin Johnson to Microsoft Employees 162   27
    Howard Center Attacks Teacher 15   27
    Mexico Update 134   27
    Saudi Women Find Freedom Through Internet Stripping 154   26
    Polar Bears Losing to Melting Ice 181   26
    Stephen Allen Devoted to Wrestling and High School 171   26
    Trap Broken on Mount Everest 151   26
    Gitmo Torture 126   25
    $10 Million Not Enough to be Rich 218   25
    One Day of the Meltdown 157   25
    Happy Birthday Sam! 98   25
    Corpse Wheeled to Check-Cashing Store Leads to 2 Arrests 118   25
    Taboo 181   25
    Guatemala: Baby Factory Nation State 147   25
    Welcome People 101   25
    Wal-Mart Exposed by Internal Videos 114   25
    Simplicity of Spots 16   24
    Mexican Drug Cartels Repulse 20,000 Soldiers 181   24
    Things I Expected By Now 138   24
    Jugs of Maple Syrup 124   24
    Montpelier Websites Running CRM 28   24
    Journal 116   24
    Barcelona United On a Roll 195   24
    Dan Allen Biography 152   24
   


login



search
Angry Old Man
angry man Reporter asks a member of the public for comments.

cURL Journal
TwitterGun Coming Up on New Technology

TwitterGun ChairmanTwitterGun Chairman
TwitterGun users react to new authentication.
By Dan Allen

cURL Journal
Twitter Interface Dumps Basic Authentication

Productive IT in Action
TwitterGun users know their needs will continue to be met under the new technology.
Twitter just changed its programmer interface for authenticating accounts. As a result, TwitterGun is down, and so is my ability to keep my Twitters updated.
By Dan Allen

Banksters
Goldman Sachs College Scam

Goldman Sachs is the majority owner of a group of for profit colleges, tying our youth into debt for over-priced education.
By Mother Jones

Banksters
Subprime Subscam

Banks bought their own collateralized debt obligations (CDO) and cranked up an assembly line that should have been stopped.
By Jake Bernstein and Jesse Eisinger ProPublica

Banksters
2008 Goldman Sachs Wheat Deal

Goldman allegedly manipulates US red wheat pricing, by using fractional reserves on client investments in wheat.
By Dan Allen

Banksters
Goldman Sachs Helps Wheat Market

Those guys at Goldman Sachs are really nice guys.
By DemocracyNow.org

Federal Government
Obama Disappointments

Washington - Liberal activists in 2008 helped turn anger into votes. Now they are disappointed that Obama's follow through has neglected their priorities. "There's definitely a frustration there..."
By David Lightman | McClatchy Newspapers | Report

The New Serf
Pawns

Serfs never have exercised power. Workers unions are the closest we have come. Participatory management is the path we must pursue.
By Dan Allen

Plane Crashed Into IRS
Why He Did It

What was Joe Stack thinking when he set his house on fire and flew his plane into the IRS office?
By Joe Stack

cURL Journal
Productive IT in Action
Dedicated teamwork makes the difference in G1 Endy racing. Here,
a team of engineers crack the cURL code for spinning the Earth.

The Earth is spinning at Dan Allen Dot Com, thanks to cURL and the Swiss Earth Observatory
By Dan Allen

Gemma's Family Plans
Gemma
Gemma goes on the record with her family plans, including husband and child.

Morality Under Review
Morality has nothing to do with our relationship to the creator of the universe. Stories about Heaven and Hell are jive, rumors adopted by leaders for their power to persuade.
By Dan Allen

Dan & Hector on Snowmass
We'd done it again, one of the best times ever.
Dan and Hector in meadow heading up Snowmass, 1985
Hector and Dan, 1985


Humans Losing to Machines

The entire business world has figured out how to make huge buckets of money without hiring us to work for them.
By Michael Moore

Comments On
Tim Geitner's NY Times Op-Ed

Secretary of Treasury, Tim Geitner
By Timothy F. Geitner, with comments interspersed by Dan Allen. Cartoon by Gary Taxali.

Anti-Corruption
Russian Policeman Blows Whistle

Russian policeman blows whistle
Compelling footage of Russian policeman fed up with corruption. More Russians following suit. Putin ignorning them for now.
By Brent McDonald, New York Times

Vermont Yankee
Brian Dubie Is Vermont Yankee's Only Hope For Public Acceptance

Brian Dubie July 3, 2010 in Montpelier for parade Brian Dubie brings rare experience of daily contact with complex machines that can kill people if they break down. Vermont Yankee might be saved, because Brian Dubie can provide Vermont-style honest technical assessment.
By Dan Allen

400,000 Year Weather Chart
Weather at a glace for the last 400,000 years on Earth. Pattern appears regular.

Vermont Proposals
Not About Jobs, Stupid

Candidates stump with endless talk of "jobs," yet, jobs are not the first thought on Vermonters' minds. "What kind of state can we make?" That is what Vermonters want to know.
By Dan Allen

Pearl Shows Compassion then Appetite for Lobster
Pearl wants to rescue the lobsters at the grocery store, but later says, "Lobsters are yummy!"
By Dan Allen

Modern Hero
All religions and myths tell the same story, a story Campbell calls the monomyth.
By Joseph Campbell

More About
My Joe Stack Story

That blurb about My Joe Stack Story is explaining a problem I am working to solve
By Dan Allen

Instead of Flying Into IRS Building
My Joe Stack Story

Except for killing himself and others, Joe Stack is pretty funny.
By Dan Allen

Justice and National Security
Ultimate Sacrifice

Death honored by our country is in some ways less of a sacrifice than standing up for the law.

Emergency Rescue
Tough Decisions

TRIAGE
By Dan Allen



overflow

home contact about music music-2 music-3 music-4 mainstream weather