• Resolved AzzX

    (@azzx)


    Currently setting up Squareup for a client and noticed images don’t sync due to the allow_url_fopen requirement. I haven’t seen this usage in code in years due to the exploitative capabilities of turning this on for php. Mosts hosts have this off by default.

    An alternative that works using curl but would be great to have it as standard.

    Function:

    function url_get_contents ( $url ) {
    
        if ( ! function_exists( 'curl_init' ) ) {
            die( 'The cURL library is not installed.' );
        }
    
        $ch = curl_init();
    
        curl_setopt( $ch, CURLOPT_URL, $url );
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
    
        $output = curl_exec( $ch );
    
        curl_close( $ch );
    
        return $output;
    
    }

    Usage:

    $remote_file_data = url_get_contents( $image_url );

    • This topic was modified 4 years, 10 months ago by AzzX.
Viewing 1 replies (of 1 total)
  • Hi there!

    Thank you for your input!

    I have passed your feedback and suggestion to our development team and they will look into it.

    I’m going to mark this as resolved – if you have any further questions or suggestions, you can start a new thread.

    Cheers!

Viewing 1 replies (of 1 total)
  • The topic ‘Image Sync url_get_contents’ is closed to new replies.