0fees.net에서 테스트 호스트를 만들었습니다. 나는 또한 내가 보내고 자하는 파일을받을 작은 PHP 스크립트를 만든다.PHP에서 cURL로 보낼 수 없습니다.
많은 시도를했지만 서버는 HTTP 403 금지됨으로 응답합니다. 자세한 출력의 실제 메시지는 내가 사용하는 코드는 내가 상기 HTTP 403 오류가 발생하기 때문에
curl_easy_setopt(curl, CURLOPT_URL, link);
curl_easy_setopt(curl, CURLOPT_HEADER, "User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.30 Safari/534.30");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt (curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
curl_easy_perform(curl);
가 curlopts 물건의 대부분은 단순히 추가
* About to connect() to ********* port 80 (#0)
* Trying 209.190.85.12... * connected
* Connected to ******* (209.190.85.12) port 80 (#0)
> POST /index.php HTTP/1.1
Host: *************
Accept: */*
Content-Length: 791
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------4cad4df8
02c5
* The requested URL returned error: 403
* Closing connection #0
* HTTP response code said error
입니다. 어떻게 해결할 수 있습니까?
P.S 이 코드는 내 로컬 호스트 설정에서 완벽하게 작동합니다!
당신이 텔넷 (또는 netcat을) 브라우저와 함께 스크립트를 액세스 해보십시오나요이 코드
확인 0fees.net에서 사용할 수 없습니다 생각하십니까? 요청을 거부 한 이유가 무엇인지 서버 로그에서 확인 했습니까? –
스크립트는 브라우저에서 작동합니다 ... telnet/netcat과 동일합니다. 죄송합니다. 작동하지 못합니다. – dikidera
로그를 보셨습니까? 이것이 가장 중요한 부분입니다. –