타사 ASP 기반 서버에 폼 데이터를 가져 오는 PHP 페이지가 있습니다. 내 웹 페이지에서 curl을 사용하여 PHP 페이지로 필드를 보내는 PHP 스크립트가 있습니다. 사용자가 텍스트에 아포스트로피 문자를 포함하는 경우를 제외하고는 모두 잘 작동합니다! 백엔드에서는 "\ '"로 수신됩니다.PHP Curl이 PHP에 보내는 아포스트로피 문자에 ''를 추가하지만 ASP 기반 서버에
odder는 호스트 된 웹 사이트에서만 수행하는 것입니다. 로컬로 테스트 할 때 정상적으로 작동합니다.
나는 호스팅 된 사이트에서 제어 할 권한이 없습니다. 모두 내 PHP 컬 기능을 작동해야합니다.
내 로컬 호스트에서 완벽하게 작동합니다. 여기
는 magic_quotes를가 켜져 샘플 코드$this->headers[] = 'Accept: '. $_SERVER['HTTP_ACCEPT']; $this->headers[] = 'Connection: Keep-Alive'; $this->headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
$post_var = 'post='.urlencode(stripslashes("it's Me Ali"));
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($this->ch, CURLOPT_HEADER, FALSE);
curl_setopt($this->ch, CURLOPT_USERAGENT, $this->USER_AGENT);
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookie);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookie);
curl_setopt($this->ch, CURLOPT_COOKIE, $strCookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'] . '; path=/');
curl_setopt($this->ch, CURLOPT_ENCODING, "gzip");
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($this->ch, CURLOPT_URL, 'http://www.example.com/form.php');
curl_setopt($this->ch, CURLOPT_POST, TRUE);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $post_var);
$get_page = curl_exec($this->ch);
echo $get_page;
curl_close($this->ch);
curl 호출이 아닌'http : // www.myhostsite.com/form.php'의 문제를 수정하십시오. – mario
나는 어떤 특권도없이 사용해야하는 http://www.myhostsite.com/form.php 서비스에 액세스 할 수 없습니다. – Ali
액세스 권한이 없으면 * magic_quotes 문제를 해결할 수 없습니다. 질문에 답했다. 문제가 해결되지 않았습니다. – mario