curl模拟post传值问题!100分!

adady 动漫基地 移动客户端工程师  2009-08-09 10:54:49
POST /Airfare/GWeb.aspx HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Referer: http://wpm.gmarket.co.kr/Airfare/FlightChoice.aspx?GoodCode=C2PEKCA2193/C2PEKCA2193&StartDt=20090827&EndDt=20090830&SCity=TAE&ECity=PEK&Adult=1&Child=0&Infant=0&ViaNo=0&StayLength=&DD=Y&OpenFlag=N
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.2; .NET CLR

2.0.50727)
Host: wpm.gmarket.co.kr
Content-Length: 275
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASP.NET_SessionId=zosbf1451ht0mo551kssrf55

post Req=<Request><AirAvailability_1_0><GoodCode>C2PEKCA2193/C2PEKCA2193</GoodCode><StartDt>20090827</StartDt><EndDt>20090830</EndDt><Type>D</Type><Way>S</Way><ViaNo>0</ViaNo><OpenFlag>N</OpenFlag><StayLength></StayLength><OneWayFlag>1</OneWayFlag></AirAvailability_1_0></Request>


以上是我得到网站的信息!

$GoodCode="C2PEKCA2133/C2PEKCA2193";
$StarDt="20090827";
$EndDt="20090829";
$Type="D";
$Way="S";
$ViaNo="0";
$OpenFlag="N";
$StayLength="";
$OneWayFlag="1";
$curlPost="GoodCode=".urlencode($GoodCode).'&StarDt='.urlencode($StarDt)."&EndDt=".urlencode($EndDt)."&Type=".urlencode($Type)."&Way=".urlencode($Way)."&ViaNo=".urlencode($ViaNo)."&OpenFlag=".urlencode($OpenFlag)."&StayLength=".urlencode($StayLength)."&OneWayFlag=".urlencode($OneWayFlag).'&SUBMIT=Send';

$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,'http://wpm.gmarket.co.kr/Airfare/GWeb.aspx');
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,80);
curl_setopt($ch,CURLOPT_POSTFIELDS,$curlPost);
$data=curl_exec($ch);
curl_close($ch);
echo $data;


这样我没有模拟成功。是不是还要模拟个头?帮下我吧。
...全文
1021 点赞 收藏 11
写回复
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
adady 2009-08-10
自己解决了.但是不知道怎么给分!
回复
nevin_xia 2009-08-09
$connection = curl_init();

curl_setopt($connection, CURLOPT_URL, 'http://wpm.gmarket.co.kr/Airfare/GWeb.aspx');
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($connection, CURLOPT_POST, 1);
curl_setopt($connection, CURLOPT_POSTFIELDS, $curlPost);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
$response=curl_exec($connection);
curl_close($connection);
echo $response;
回复
fenyao 2009-08-09
回复
残剑无弦 2009-08-09
不知道楼主为什么要把.NET问题发到PHP区里来

看在这么多分的份上我还是帮忙顶顶吧 顺便接点分~~
回复
同意9楼,你先检查一下配置先
回复
nevin_xia 2009-08-09
你要检查一下 看你php.ini配置里 curl模块是否开启的
回复
nevin_xia 2009-08-09
返回什么错误?
回复
adady 2009-08-09
[Quote=引用 3 楼 nevin_xia 的回复:]
$connection = curl_init();

curl_setopt($connection, CURLOPT_URL, 'http://wpm.gmarket.co.kr/Airfare/GWeb.aspx');
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($connection, CURLOPT_POST, 1);
curl_setopt($connection, CURLOPT_POSTFIELDS, $curlPost);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
$response=curl_exec($connection);
curl_close($connection);
                echo $response;
[/Quote]


还是返回错误
回复
残剑无弦 2009-08-09
呵呵 瞄了一眼 瞅错了
回复
adady 2009-08-09
[Quote=引用 1 楼 dean_l 的回复:]
不知道楼主为什么要把.NET问题发到PHP区里来

看在这么多分的份上我还是帮忙顶顶吧  顺便接点分~~
[/Quote]



明明就是php..
回复
ttm1984 2009-08-09
curl_setopt($connection, CURLOPT_POST, 1);
回复
发动态
发帖子
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
社区公告
暂无公告