我可以从自己的网站在外部网站上填写表格吗


Can I fill a form on an external site from my own site?

我不确定这是否可能,但如果可能,我至少需要知道从哪里开始。我想在我不拥有的网站上填写表格,使用我拥有的网站的字段。

特别是这个电脑游戏网站http://www.g2a.com/,以及那里的搜索表单,即

<input type="text" class="mp-h-main ui-autocomplete-input" id="product-autocomplete" placeholder="Search a game" data-rel="active" autocomplete="off" state="closed">

它似乎加载了Ajax或jQuery,并且网站上似乎没有常规的搜索功能。有没有一个好的已知方法,或者在这种情况下我几乎没有机会?

谨致问候,John

使用firefox的实时http头之类的东西来嗅探表单发布内容,并使用php-ccurl进行模拟,即:

<?php
$productName = rawurlencode("DOOM STEAM CD-KEY PREORDER GLOBAL");
$url = "https://www.g2a.com/lucene/search/quick?jsoncallback=jQuery111005943281338131983_1462669099509&phrase=$productName&isWholesale=false&cn=&skip=28837%2C28838%2C28847%2C28849%2C28852%2C28856%2C28857%2C28858%2C28859%2C28860%2C28861%2C28862%2C28863%2C28867%2C28868%2C29472%2C29473%2C29474%2C33104&start=0&rows=5&_=1462669099513";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Host: www.g2a.com",
"Accept: text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01",
"Accept-Language: en-US,en;q=0.5",
"Accept-Encoding: gzip, deflate, br",
"X-Requested-With: XMLHttpRequest",
"Referer: https://www.g2a.com/",
"Cookie: store=englishus; user_time_offset=-120; _ga=GA1.2.1616293500.1462668986; PHPSESSID=eemnk12t6fml8l0l0mf3l63tr5; currency=USD; _gat=1; __ar_v4=WZC2HGDHXZBR7NN565K5H7%3A20160507%3A3%7CY5G5B7MZYJA65OM2BVC43V%3A20160507%3A3%7CJOM3QZF4VBESRIYVTRCJ3R%3A20160507%3A3; Hm_lvt_11391e2f2164ca5838ee836fac473f57=1462668991,1462669101; Hm_lpvt_11391e2f2164ca5838ee836fac473f57=1462669101; external_no_cache=1",
"Connection: keep-alive"
    ));
$response = curl_exec($ch);
echo $response;
curl_close ($ch);

输出:

jQuery111005943281338131983_1462669099509({"numFound":1,"start":0,"docs":[{"id":27581,"name":"DOOM STEAM CD-KEY PREORDER GLOBAL","type":"egoods","preOrder":1,"slug":"/doom-steam-cd-key-preorder-global.html","addUrl":"uenc/aHR0cDovLw,,/product/27581/","minPrice":32.99,"g2aQty":1,"g2aPrice":32.99,"retailQty":0,"wholesaleQty":0,"thumbnail":"https://images.g2a.com/m/58x58/1x1x1/thumbnail/d/o/ef1f8c916783_doom_2d_3.png","brandsDirectOnSearch":0,"bdPrice":0}]})