서버의 스크립트에 데이터를 게시해야합니다. curl을 사용하고 자세한 오류보고를 사용하고 있습니다. 아무도 왜 이것이 작동하지 않는지 알 수 있습니까?문제 해결 방법 - CURL 스크립트로 데이터 게시
surname=smth&address1=No+Value&this=that
:
이
<?php log_error("success",ERROR_LOG_TO_STDERR); ?>
내 포스트는 다음과 같이 문자열을 바르 :
감사합니다,
게시 스크립트
function makePost($postvars, $count) {
$url = 'http://servername.something.org/php/callback-f.php';
$ch = curl_init();
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$postvars);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$result = curl_exec($ch);
curl_close($ch);
}
에 게시 된 스크립트는이 줄을 포함
내가 돌아올 결과는 이것이다 :
Connected to myserver.org port 80
> POST /php/callback-f.php HTTP/1.1
Host: myserver.org
Pragma: no-cache
Accept: */*
Content-Length: 1510
Content-Type: application/x-www-form-urlencoded
< HTTP/1.1 301 Moved Permanently
< Location: https://myserver/php/callback-f.php
< Content-Length: 0
< Date: Wed, 16 Nov 2011 16:21:23 GMT
< Server: lighttpd/1.4.28
* Connection #0 to host left intact
* Closing connection #0
테스트 스크립트가 https를 통해서만 액세스 할 수 있지만 http를 통해 게시하는 것 같습니다. – liquorvicar