rendered paste bodyfunction pledgebank_form(&$node) { $form['details']['#after_build'] = array('pledgebank_remote'); $form['details']['url'] = array( '#type' => 'textfield', '#title' => t('URL of this pledge from Pledgebank.com'), '#required' => TRUE, '#default_value' => $node->url ); $form['details']['title'] = array( '#type' => 'value', '#title' => t('Title'), '#required' => TRUE, '#default_value' => $node->title ); return $form;}function pledgebank_remote($form) { // skip if not changed if ($form['url']['#value'] == $form['url']['#default_value']) return $form; $url = $form['url']['#value'] . "/plain"; // Retrieve contents of PB URL with cURL and convert to an array called $pb $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 0); ob_start(); curl_exec ($ch); curl_close ($ch); $pbxml = ob_get_contents(); ob_end_clean(); $pb = xmlFileToArray($pbxml); // Move dates to timestamps $pb['creation_date'] = strtotime($pb['creation_date']); $pb['last_change_time'] = strtotime((str_replace('Z','',str_replace('T',' ',$pb['last_change_time'])))); $pb['deadline'] = strtotime((str_replace('Z','',str_replace('T',' ',$pb['deadline'])))); $form['title']['#value'] = $pb['title']; form_set_value($form['title'], $pb['title']); return $form;}