protected function _browseToHomePage() { $ch = curlInit(); curlSetopt($ch, CURLOPT_URL, SHIPPING_FEDEX_HOME_SERVER); curlSetopt($ch, CURLOPT_USERAGENT, SHIPPING_FEDEX_SERVER_USERAGENT); curlSetopt($ch, CURLOPT_FAILONERROR, 1); curlSetopt($ch, CURLOPT_FOLLOWLOCATION, 1); curlSetopt($ch, CURLOPT_TIMEOUT, SHIPPING_FEDEX_SERVER_TIMEOUT); curlSetopt($ch, CURLOPT_COOKIEJAR, SHIPPING_FEDEX_SERVER_COOKIE_FILE); curlSetopt($ch, CURLOPT_RETURNTRANSFER, 1); curlExec($ch); if (curlErrno($ch) != 0) { Debug::writeError('curl error', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('error' => curlError($ch))); curlClose($ch); return false; } curlClose($ch); return true; }
$info['http_code'] == 200 || ($resp_body = NULL); // curlClose(); //debug // echo $method.' ::'.$url. " \n"; // if (!empty($values)) echo "> \n> ".$values."\n> \n"; // echo'<'.str_replace("\n", "\n< ", $resp_body)."\n\n"; //end debug return $resp_body; } function curlClose() { global $ch; curl_close($ch); } curlInit(); var_dump(execRequest('DELETE', 'http://localhost:4269/api/1.0/layers/restaurants.json')); var_dump(execRequest('POST', 'http://localhost:4269/api/1.0/layers/restaurants.json')); var_dump(execRequest('GET', 'http://localhost:4269/api/1.0/layers/index.json')); var_dump(execRequest('PUT', 'http://localhost:4269/api/1.0/records/restaurants/info.json', 'secret_key=supersecret&last_update=2001/07/08')); var_dump(execRequest('GET', 'http://localhost:4269/api/1.0/records/restaurants/info.json')); var_dump(execRequest('PUT', 'http://localhost:4269/api/1.0/records/restaurants/abcd.json', '_loc=48.512,2.243')); var_dump(execRequest('GET', 'http://localhost:4269/api/1.0/records/restaurants/abcd.json')); var_dump(execRequest('PUT', 'http://localhost:4269/api/1.0/records/restaurants/abcd.json', 'name=MacDonalds&closed=1&address=blabla&visits=100000')); var_dump(execRequest('GET', 'http://localhost:4269/api/1.0/records/restaurants/abcd.json')); var_dump(execRequest('PUT', 'http://localhost:4269/api/1.0/records/restaurants/abcd.json', '_delete:closed=1&_add_int:visits=127')); var_dump(execRequest('GET', 'http://localhost:4269/api/1.0/search/restaurants/nearby/48.510,2.240.json?properties=1&radius=7000')); var_dump(execRequest('GET', 'http://localhost:4269/api/1.0/search/restaurants/in_rect/48.000,2.000,49.000,3.000.json?properties=0')); var_dump(execRequest('GET', 'http://localhost:4269/api/1.0/system/ping.json')); var_dump(execRequest('POST', 'http://localhost:4269/api/1.0/system/shutdown.json')); curlClose();