You can set the URL field type value with a string.
$entry->example = "http://pyrocms.com"; copy
$entry->example = "http://pyrocms.com";