PHP를 사용하는 cURL에 대해 다음 코드가 있습니다.cURL 응답은 200이지만 실제로 값을 게시하지 않습니다.
$product_id_edit="Playful Minds (1062)";
$item_description_edit="TEST";
$rank_edit="0";
$price_type_edit="2";
$price_value_edit="473";
$price_previous_value_edit="473";
$active_edit="1";
$platform_edit="ios";
//set POST variables
$url = 'https://www.domain.com/adm_test/phpgen/offline_items.php?operation=insert';
$useragent = 'Mozilla/5.0 (Windows NT 6.1; rv:8.0.1) Gecko/20100101 Firefox/8.0.1';
$fields = array(
'product_id_edit'=>urlencode($product_id_edit),
'item_description_edit'=>urlencode($item_description_edit),
'rank_edit'=>urlencode($rank_edit),
'price_type_edit'=>urlencode($price_type_edit),
'price_value_edit'=>urlencode($price_value_edit),
'price_previous_value_edit'=>urlencode($price_previous_value_edit),
'active_edit'=>urlencode($active_edit),
'platform_edit'=>urlencode($platform_edit)
);
$fields_string="";
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
//add useragent
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch,CURLOPT_POST,count($fields));
//execute post
$result = curl_exec($ch);
if(curl_errno($ch)){
print "" . curl_error($ch);
}else{
//print_r($result);
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
//echo "HTTP Response Code: " . curl_error($ch);
echo $httpCode;
//close connection
curl_close($ch);
나는 $ httpCode를 인쇄했습니다. 나는 코드 200을 얻는다; 나는 수동 페이지에서 읽었으므로 OK입니다. 그러나 사이트를 점검 할 때 게시 된 값은 존재하지 않습니다.
게시자가 아니기 때문에 도메인 간 관련이 있습니다. 127.0.0.1/site/scrpt.php에서이 작업을 수행하고 있지만 성공하지 못하면 어떻게 응답 코드 200을 얻을 수 있습니까?
나는 또한 함께 URL https://www.domain.com/adm_test/phpgen/offline_items.php?operation=insert을 가지고 있습니까 나는 그것이(이 컬을 내 가정에서 제대로 작동하고 있음을 의미합니다) 404를 반환 한 요청 URL에 일부를 제거하여 한 404을 얻기 위해 노력 "? operation = insert"는 그것과 관련이 있습니까?
다른 사이트의 게시물이고 다른 웹 사이트 형식의 값인 post'a 로봇을 사용한다고 가정 해 봅시다. tho 내 목표는 악의적 인 의도를 암시하지 않는다. 이것이 가능하지 않다면 나는 천 라인의 정보를 암호화해야만한다.
마찬가지로, 나는 서버의 응답이 필요하지 않습니다 (하지만 하나가 가능한 다음의 잘 경우)
왜 이것을 javascript 및 jQuery로 태그 지정 했습니까? –