get_data function for curl