通过cURL从外部网站获取一些数据

I want to pull some html pice of code with some data from an external website with cURL, but a recived a null response. If I type the url in browser i get the data that i want but i need to do that from my app via cURL or file_get_contents();

This is my code :

    $_awb = '888000074599';
    $url = 'http://89.45.196.45';
    $post_fields = ':8080/?id=8IM*8J*9K&NT='.$_awb;

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);

    $result = curl_exec($ch);
    curl_close($ch);

You should not be using CURLOPT_POSTFIELDS. You are trying to do a GET request with a query string, but postfields is intended for making POST requests.

So setting CURLOPT_URL to the proper (absolute) URL should work.

    $url = "http://89.45.196.45:8080/?id=8IM*8J*9K&NT="
    $nt = "888000074599";

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url . $nt);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    $result = curl_exec($ch);
    curl_close ($ch);