1

所以我什至不知道这是否可能,但基本上我想为一个客户创建一个后台办公室,以处理他在两个市场(play.com 和亚马逊)上的销售。

我可以用 PHP 填写表格和发送数据吗?我可以登录网站来抓取日期吗(新订单等)

我在那里找到了部分答案: Creating a 'robot' to fill form with some pages in

我怀疑 PHP 不是这种语言,任何建议将不胜感激!

4

5 回答 5

2

答案的另一部分就在这里。您可以使用cURL.

使用cURL您可以登录网站。此处的示例示例为您提供了一个快速入门。

<?php
$username="name@mail.com"; 
$password="mypassword"; 
$url="http://www.myremotesite.com/login.php"; 

$postdata = "email=".$username."&password=".$password; 

$ch = curl_init(); 
curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_REFERER, $url); 
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
curl_setopt ($ch, CURLOPT_POST, 1); 
$result = curl_exec ($ch); 

echo $result;  
curl_close($ch);
于 2013-10-24T17:16:06.850 回答
0

您可以尝试SimpleTest,但通常大型服务会提供 API 接口与它们进行交互。

于 2013-10-24T17:16:11.307 回答
0
$q="INSERT INTO `table`(`fname`, `lname`, `phone`, `zipcode`, `status`, `pregnant`, `month`, `day`, `year`, `ft`, `inch`, `lb`, `people`, `email`, `annual`, `recent`, `address`, `city`, `state`, `quotetype`, `unsubscribe`, `unsubscribe_type`) VALUES (
    '".$_POST['fname']."',
    '".$_POST['lname']."',
    '".$_POST['ph']."',
    '".$_POST['zip']."',
        'Accept',
    '".$_POST['gender']."',
    '".$_POST['mm']."',
    '".$_POST['dd']."',
    '".$_POST['yyyy']."',
    '5','8','80',
    '".$_POST['kids']."',
    '".$_POST['email']."',
    '".$_POST['income']."',
    '".$_POST['type']."',
    '".$_POST['address']."',
    '".$_POST['city']."',
    '".$_POST['state']."',
    'Lead','0','no')";
    $sql=mysql_query($q);
    if($sql)
    {echo "Lead Successfully submitted";}
    else
    {echo "Not Done";} 
    //Recive Data page like : get-data.php
于 2015-10-16T11:40:18.803 回答
0

$handle = curl_init();

$url = "http://example.com/test.php";

// 包含字段名称和值的数组。

$postData = 数组(

'名字' => '',

'姓氏' => '嘎嘎',

'提交' => '好的' );

curl_setopt_array($handle,

数组(CURLOPT_URL => $url,

 // Enable the post response.

CURLOPT_POST       => true,

// The data to transfer with the response.

CURLOPT_POSTFIELDS => $postData,

CURLOPT_RETURNTRANSFER     => true, ));

$data = curl_exec($handle);

curl_close($handle);

回显$数据;

于 2020-08-30T14:36:34.833 回答
-1
$url="https://example.com/add_lead.php"; 

$postdata = "fname=".$fname."&lname=".$lname."&mm=".$mm."&dd=".$dd."&yyyy=".$yyyy."&email=".$email."&city=".$city."&state=".$state."&zip=".$zip."&address=".$address."&gender=".$lname."&ph=".$ph."&income=".$income."&type=".$type."&kids=".$kids; 

$ch = curl_init(); 
curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_REFERER, $url); 
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
curl_setopt ($ch, CURLOPT_POST, 1); 
$result = curl_exec ($ch); 

echo $result;  
curl_close($ch);

//发送请求参数页面,如send-data.php

于 2015-10-16T11:36:07.730 回答