PHP의 Curl을 통해 Census Geocoding API를 사용하려고합니다.CURL 오류 게시 파일
이이 API에서 다시 오류를 받고 결과$post = array('benchmark' => 'Public_AR_CENSUS2010', 'addressFile'=>'@C:\TestData.csv');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://geocoding.geo.census.gov/geocoder/locations/addressbatch/');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result=curl_exec ($ch);
echo($result);
curl_close ($ch);
: 내가 명령 줄을 형성 말림 호출 할 경우,
"From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1: 10.4.1 400 Bad Request. The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications."
그러나, 그것은 잘 작동 여기에 (의 아래 손질 버전) 내 코드는 ...
curl --form [email protected]"C:\TestData.csv" --form benchmark=PUBLIC_AR_CENSUS2010 http://geocoding.geo.census.gov/geocoder/locations/addressbatch
무엇이 잘못 되었습니까?
하나가 작동하고없는 경우 전송 된 헤더를 비교하여 누락 된 항목을 확인합니다. 명령 줄에'-v'를 추가하고 [가장 높은 투표 응답을 읽습니다.] (http://stackoverflow.com/questions/3164405/show-curl-post-request-headers-is-there-a-way- to-do-this)를 PHP 용으로 사용할 수 있습니다. –