Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP 'file' problem

Options
  • 31-03-2009 11:42am
    #1
    Registered Users Posts: 8,070 ✭✭✭


    running php 4.x

    trying to retrieve data returned by a url using 'file' but doesnt seem to work at all?

    also tried simple
    [PHP]
    $url = "http://www.google.com";
    $html = file_get_contents(urlencode($url)) or die("Can't open url");
    echo $html; [/PHP]

    no joy.


Comments

  • Registered Users Posts: 8,070 ✭✭✭Placebo


    looks like hosting365 have blocked it for security purposes.
    Using curl instead

    [PHP]<?php
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://example.com/");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_exec($ch);
    curl_close($ch);
    ?>[/PHP]


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    This was a massive secuity flaw in PHP for years; it's handy if you need it but it's a huge hole if it's not required and scripts aren't set up to recognise abuse.

    They finally disabled it by default in PHP 5.


Advertisement