Jump to content
X2Community Forums

Recommended Posts

Hi Everyone,

 

I'm not new to development, but I'm new to PHP and cURL. I'm just working on a project for a friend, attempting to tie his website to his CRM. I'm getting a 415 from a basic api request and I'm guessing someone can probably take one look at this code and tell me what I'm missing. Any help would be appreciated.

 

Thanks

Robert

$curl = curl_init();    
    curl_setopt($curl, CURLOPT_HTTPHEADER, "Content-Type: application/json; charset=utf-8");
    curl_setopt($curl, CURLOPT_HEADER, 1);
    curl_setopt($curl, CURLOPT_USERPWD, $username . ":" . $password);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_URL, $baseUrl . "Opportunity");
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncodedContent);

    $response = curl_exec($curl);
    
    if( $response === false)
    {
        echo 'Curl error: ' . curl_error($curl);
    }
    else
    {
        echo $response;
    }
Link to post
Share on other sites
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...