Php 无法连接到URL

Php 无法连接到URL,php,api,curl,Php,Api,Curl,我无法使用PHP连接Curl URL。 下面是我试图执行的代码 $url="http://b2b-dev.cenveo.com:6700/dmz/EZComm?fromTp=DiscountLabelsCustomer&toTp=DiscountLabels&operationID=DiscountLabels/1.0/PurchaseOrderRequest"; $xml_content = '<?xml version="1.0" encoding="utf-8"?&

我无法使用PHP连接Curl URL。 下面是我试图执行的代码

$url="http://b2b-dev.cenveo.com:6700/dmz/EZComm?fromTp=DiscountLabelsCustomer&toTp=DiscountLabels&operationID=DiscountLabels/1.0/PurchaseOrderRequest";

$xml_content = '<?xml version="1.0" encoding="utf-8"?><Order xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.discountlabels.com http://www.discountlabels.com/DLI_INTGR.xsd" SubmittedDate="2017-12-06 02:52:43" xmlns="http://www.discountlabels.com"><Customer><Name>Cmagnets</Name><PSCustID>987654</PSCustID></Customer><BlindDropshipAddress AddressID=""><Name></Name><Attention></Attention><PostalAddress><Address1></Address1><Address2></Address2><City></City><State></State><PostalCode></PostalCode><Country></Country></PostalAddress><Email></Email><Telephone><PhoneNumber></PhoneNumber></Telephone>
    <Fax></Fax><URL></URL></BlindDropshipAddress><Item ItemNumber="1"><Product><CustomDescription>Test product.</CustomDescription>
      <ProductCode>1 x 4</ProductCode><Type>Labels</Type><SubType>Standard</SubType><Shape>Rectangle</Shape><ShapeType></ShapeType>
      <ProductClass>L</ProductClass><Width>1.0</Width><Height>4.0</Height><Diameter>0.0000</Diameter></Product><Quantity>1000</Quantity><Ink>Black</Ink><Artwork><ArtPath></ArtPath><UserFilename></UserFilename></Artwork><PONumber>PO12345</PONumber>
    <FirstLineOfCopy>Test Copy</FirstLineOfCopy><Shipping><Quantity>1000</Quantity><ShipMethod>Fedex</ShipMethod><ShipToAddress AddressID=""><Name>Name</Name><Attention>Sally Sunshine</Attention><PostalAddress><Address1>901 Some Street</Address1>
          <Address2>Suite ABC</Address2><City>New Orleans</City><State>LA</State><PostalCode>39532</PostalCode><Country>US</Country></PostalAddress><Email>sally.sunshine@somecompany.com</Email><Telephone><PhoneNumber>5419876543</PhoneNumber><Extension /></Telephone><Fax><PhoneNumber></PhoneNumber><Extension /></Fax><URL></URL></ShipToAddress><Dropship>false</Dropship>
    </Shipping><Stock><StockType></StockType><StockSubType></StockSubType><StockColor></StockColor><TintColor></TintColor>
      <InsideWindow>false</InsideWindow></Stock><ConsecutiveDigit><BeginDigit></BeginDigit><EndDigit></EndDigit><DigitType></DigitType><SequenceType></SequenceType></ConsecutiveDigit><ItemSpecs><Attribute>Bleed</Attribute><Value>True</Value>
    </ItemSpecs><CustPONumber></CustPONumber><Comments>Item Comments</Comments></Item></Order>';
$ch = curl_init();
url_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HEADER, 1); 
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_ENCODING, 'identity');
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_HTTPHEADER,array("Content-Type: application/xml", "Accept: application/xml"));
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);  //times out after 4s 
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_content); // add POST fields 
curl_setopt($ch, CURLOPT_POST, 1); 
$output = curl_exec($ch);
print_r($output);
if (curl_errno($ch)) {
  echo 'Error: ' . curl_error($ch);
}

提前感谢

您可能缺少一些标题,或者您必须使用cenveo将服务器的ip地址列入白名单。没有与curl相关的错误,相反的服务器拒绝您的连接。

此问题可能与您的相关:
Error: Failed to connect to b2b-dev.cenveo.com port 6700: Connection refused.