如何同时刮取所有Url数据..?

时间:2016-07-12 11:45:19

标签: php

<?php 

$send=$_GET['send'];
$delv=$_GET['delv'];
$weight=$_GET['weight'];
    $postData ='{"CollectionCountry": '.$send.' ,"CollectionPostcode":null,"CollectionTown":null,"DeliveryCountry": '.$delv.' ,"DeliveryPostcode":null,"DeliveryTown":null,"RequiresCommercialInvoice":false,"CollectionDate":null,"QuoteValue":null,"Parcels":[{"Weight":'.$weight.',"Length":null,"Width":null,"Height":null}],"Columns":[{"Header":"Next Day Delivery","Template":"GRID_RESULTS_COLUMN","Endpoint":"/quotes/api/results/column?deliveryTimes=1","Description":null,"Feature":null,"IncludeTags":[],"ExcludeTags":[],"hasResults":true,"loading":true},{"Header":"2 Day Delivery","Template":"GRID_RESULTS_COLUMN","Endpoint":"/quotes/api/results/column?deliveryTimes%5B0%5D=2&deliveryTimes%5B1%5D=50&deliveryTimes%5B2%5D=54","Description":null,"Feature":null,"IncludeTags":[],"ExcludeTags":[],"hasResults":true,"loading":true},{"Header":"3+Day Delivery","Template":"GRID_RESULTS_COLUMN","Endpoint":"/quotes/api/results/column?deliveryTimes%5B0%5D=3&deliveryTimes%5B1%5D=51&deliveryTimes%5B2%5D=55","Description":null,"Feature":null,"IncludeTags":[],"ExcludeTags":[],"hasResults":true,"loading":true}],"QuoteResultLayout":null,"QuoteType":0,"SortOptions":[{"desc":"Most Popular","sortfield":"Recommended","sortdesc":false,"id":"recommended|false"},{"desc":"Price Low-High","sortfield":"Total","sortdesc":false,"id":"total|false"},{"desc":"Price High-Low","sortfield":"NetTotal","sortdesc":true,"id":"nettotal|true"},{"desc":"Drop-Off Distance","sortfield":"Distance","sortdesc":false,"id":"distance|false"}],"CurrencyCode":"GBP"}';
//print_r ($postData); exit;    
    $jsonUrl = 'https://.......................?deliveryTimes%5B0%5D=3&deliveryTimes%5B1%5D=51&deliveryTimes%5B2%5D=55';
    $jsonUrl = 'https://................................?deliveryTimes%5B0%5D=2&deliveryTimes%5B1%5D=50&deliveryTimes%5B2%5D=54';
    $jsonUrl = 'https://........................?deliveryTimes=1';

    $headers = array('Accept: application/json, text/plain, */*',
    'Content-Type:application/json;charset=utf-8'
    ,"Accept-Encoding:gzip, deflate, br",
    "RequestVerificationToken: TAiNDImqOxcL_yssZeYVp0PwTBy3ow4NQ6JttPvmYsfuum_05vcVLknFgdgxZl_zOrwH0BAuOz68cFNJoPv8uui8k9Y1",
    //"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0",
    //"Referer: https://www.parcel2go.com/quotes?col=219&dest=219&p=1~23",
    //"Host: www.parcel2go.com",
    "Connection:keep-alive",
    "Cache-Control:max-age=0",
    "Accept-Language:en-US,en;q=0.5",
    "Host: www.parcel2go.com",
    "Cookie:_qst_s=4; _qubitTracker=1467700893010.547270; _qst=%5B4%2C0%5D; qb_ss_status=r21:R&I8+|5+3:IQ&LZe|/kQ:OB&MOE|BDaW:r&M4S|BDao:He&M4U|BDbZ:H3&M4Z|BDbk:Hm&M4a|BEBn:Ly&M/C|BE/i:LJ&NI+|BFSr:B2&NMT|BFc5:C/&NNz|BFdp:GM&NN7|BGVY:EX&NWg|BGlf:KK&NZg|BHQ8:J&Nie|BISk:CM&Nwd|BITj:CX&Nwr|BJ1C:Fd&OAN|BJ4O:0&OAn|BJ5E:Hl&OAw|BJ9l:I1&OBc|BKeb:MN&OGy|BLmz:Na&KEi|BMB/:Jl&OW5|BMCO:Ef&OW+|BNmi:PN&Ol2|BQG1:/&PFT|BQUP:Oz&PH7|BQUS:MM&PH8|BQVc:LT&PII|BQVg:D6&PIJ|BQVq:Ke&PIM|BQVu:Gq&PIN|BRoY:Nb&PVo|BSs8:MG&PhV; _qb_se=r21:I8+&VXOdorD|/kQ:MOE&VXOdorE|BDaW:M4S&VW5ywVV|BEBn:M/C&VXOKaxZ|BFc5:NNz&VXOKaxk|BGlf:NZg&VXOKaxb|BITj:Nwr&VXOKaxd|BJ1C:OAN&VXOdorH|BNmi:Ol2&VXOdorF|BQUP:PH7&VXOKaxn|BQVc:PII&VXOKaxq; x_t039_seen=true; qb_permanent=1467700893010.547270:7:1:4:4:0::0:1:0::::::::::::::::::segments~1I@A&l@A&J_A&K_A&G_A&a_A&m@A&H_A&b_A&M@A::; x_ss002_variation=DomesticPriceChanges; x_dg004_variation=true; _ga=GA1.2.385925508.1467700934; x_qb_block=1; x_dg007_variation=true; qq_results_filter=total|false; _cs_id=317bd8ee-1afe-a06b-aec7-32eef762cb22.1467701049.8.1468047750.1468047641; sn.vi=vi||2d9b5ad8-d4ec-41aa-ad75-f835d3f1e56a; 45520235-VID=1713901327918342; ARRCookie=d8bdc008a4607e6ff76c1bba4628b53b4e1fc75eb59a830e24f4200fde1db4aa; _qsst_s=1468047716143; qb_filter_ip_match=false; _qPageNum_parcel2go=0; _qsst=1468047717708; _cs_v=0; _cs_r=0; _cs_cvars=%7B%221%22%3A%5B%22page_type%22%2C%22Listing%22%5D%2C%222%22%3A%5B%22breadcrumb%22%2C%22Quick%20Quote%22%5D%7D; sc.ASP.NET_SESSIONID=nqx1luablbghdftje5ox33ns; sc.Status=8; 45520235-SKEY=6917772268547809234; HumanClickSiteContainerID_45520235=STANDALONE; ASP.NET_SessionId=uhem0dxwx5thnang4roq0hjz; __RequestVerificationToken=89KOpsfajfi0CFLjnXSrS8FnCykFuzKORkQ3d3sgb3FjjG77gxEBXG5go4uT_VQSlakVEOOuJzN70bNjnAxYkjMuYC41; _cs_s=2; x_qtag_1892842=EYVparcel2go.com*1468047716147*Idirect*results*quotes*.dest*kcol*+219@*a*Qsc*Q*j4*C*B4*C*P7*5-@1-*C*R*Z*a*@2-*Y*9-*@0-/*Y*A1467700880903*b*C*a*@2-*Y*9-*@0-/*Y*A1467703616020*b*C*a*@2-*Y*9-*@0-/*Y*A1468042346549*b*C*a*@2-*Y*9-*@0-/@4-*@6-*@7-*@5-*@7-*.p*+1*o23*f/@3-*Y*A@1-*b*E*C*F*Q*@0-/@4-*@6-*@7-*@5-*@7-*.p*+1*o23*f/@3-*Y*Q__v*z; qb_session=1:1:15:; ss_opts=r21:H&H|/kQ:H&H|BDaW:B&B|BEBn:D&D|BFc5:C&C|BGlf:D&D|BITj:D&D|BJ1C:E&E|BNmi:H&H|BQUP:D&D|BQVc:D&D|_g:VXOdoHT&VXOdoHT&E&B; _gat=1; sn.ds=d||a");

    $resultsHTML =CurlWrapper::SendRequest($jsonUrl, 'https://.........?col=219&dest=219&p=1~23', 
    "POST", $postData, $headers);
    $resultsJson = json_decode($resultsHTML);
?>

我有三个url($ jsonUrl),这段代码只有一个url数据用于使用此代码。但我同时获取所有网址数据。所以PLZ帮助我.. ???

0 个答案:

没有答案