The US President is in Afghanistan for talks with President Hamid Karzai, after surviving a shoe attack in Iraq.