我的错误就是这个,我有这些变量:
C:/romanchenko_test_task/static/first-style.css
的file_get_contents($请求);
所有这些变量都会自动填充,但是当我使用file_get_contents运行时,答案是这样的:
$request = "https://xxxxx.xxx.com/2/delivery/request?";
$request.= "api_key=".$api_key."&";
$request.= "user_id=".$user_id."&";
$request.= "deliveery_type=".$delivery_type."&";
$request.= "route=E.+Pallares+y+&";
$request.= "street_number=110&";
$request.= "neighborhood=San Lucas&";
$request.= "locality=Distrito&";
$request.= "administrative_area_level_1=Distrito&";
$request.= "postal_code=04030&";
$request.= "country=Mexico&";
$request.= "latlng=".$latlng."&";
$request.= "destination-route=".$destination_route."&";
$request.= "destination-street_number=&";
$request.= "destination-neighborhood=&";
$request.= "destination-locality=".$destination_locality."&";
$request.= "destination-administrative_area_level=".$destination_administrative_area_level."&";
$request.= "destination-postal_code=".$destination_postal_code."&";
$request.= "destination-country=Mexico&";
$request.= "destination-latlng=".$d_latlng."&";
$request.= "customer_email=".$customer_email."&";
$request.= "customer_phone=".$customer_phone."&";
$request.= "notification_email=&";
$request.= "notes=".$notes."&";
$request.= "dispatch=True";
在我的error_log中检查,我看到网址已完成,但我不知道为什么会出现这些错误
答案 0 :(得分:0)
我认为您希望对每个参数/值段中的值进行urlencode,如下所示:
$request = "https://www.site.tld/path/to/api?param=" . urlencode($value);
...等
答案 1 :(得分:0)
您应该尝试发送gets as stream方法;
您可以在
获取更多信息http://php.net/manual/en/function.file-get-contents.php
这将使用php提供的内置功能