M
M
Mile43111122020-04-16 14:39:18
PHP
Mile4311112, 2020-04-16 14:39:18

Why doesn't CURL send?

$url = 'https://crm...'. http_build_query($postData);

    //Setup cURL
    $ch = curl_init();

    //The site we'll be sending the POST data to.
    curl_setopt($ch, CURLOPT_URL, $url);

    //Tell cURL that we want to send a POST request.
    // curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
  curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');

    //Attach our POST data.
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

    //Tell cURL that we want to receive the response that the site
    //gives us after it receives our request.
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, TRUE);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);

    //Finally, send the request.
    curl_exec($ch);

    $url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
    $error['url']=$url;
    //Close the cURL session
    curl_close($ch);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question