PHP, curl: malformed url error

Forum for users and developers of Bullhorn's new REST API service.

Moderators: StaffingSupport, s.emmons, BullhornSupport

Quizathaderac
User
Posts: 3
Joined: Sat Dec 30, 2017 3:56 am

PHP, curl: malformed url error

Postby Quizathaderac » Sat Dec 30, 2017 4:06 am

when attempting to invoke a query URL in PHP via curl I'm getting a false back and "malformed" as the error message However I'm utterly unable to find anything wrong with my URL and I'e gotten it to work perfectly in both java and my browser.

My PHP

Code: Select all

$openUrl = $session['restUrl'] . 'query/JobOrder?BhRestToken=' . $session['BhRestToken'] .
   "&where=status%3D'Active'%20and%20isOpen%3Dtrue&" .
   "fields=id,status,isOpen,clientCorporation,type,owner,dateAdded," .
   "dateLastModified,salary,employmentType,submissions,interviews,title&count=40";
   
$curl = curl_init( $openUrl);

curl_setopt($curl, CURLOPT_URL, $$openUrl);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT,60);
$openReqs = curl_exec( $curl );
var_dump($openReqs);//returns false
echo("<br>response code _".curl_error ( $curl)."_<br>");//prints "malformed"
curl_close( $curl );

The whole url (with the actual token value removed) is:

Code: Select all

https://rest32.bullhornstaffing.com/rest-services/25zj09/query/JobOrder?BhRestToken=############&where=status%3D'Active'%20and%20isOpen%3Dtrue&fields=id,status,isOpen,clientCorporation,type,owner,dateAdded,dateLastModified,salary,employmentType,submissions,interviews,title&count=40

Quizathaderac
User
Posts: 3
Joined: Sat Dec 30, 2017 3:56 am

Re: PHP, curl: malformed url error

Postby Quizathaderac » Sat Dec 30, 2017 7:58 pm

Figured it out; simple typo.


Return to “REST API”

Who is online

Users browsing this forum: No registered users and 3 guests