My hosting provider no longer offers curl support and that's all I've used before for the functionality I've needed.
In particular, I'm looking for an alternative to curl to make this function work...
private function GetQueryResponse($requestUrl, $postString) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $requestUrl);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
I've been looking at fopen and file_get_contents from what info I could find on the board here, but I'm in a time crunch and can't seem to wrap my head around how i might make an alternative function. Any help would be greatly appreciated.
Ahhh! no more cURL, what do I do?
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: Ahhh! no more cURL, what do I do?
I'm totally stealing this off of a search on Google so I'll quote it...
Beyond that I'm not sure. You really don't want to depend too heavily on cURL for mission-critical stuff. What would happen if the page you're getting information from changes?There's the HTTP_Request PEAR library; you could use system() to call a command-line tool such as "/usr/bin/wget" or "/usr/bin/GET";
Re: Ahhh! no more cURL, what do I do?
Well, it makes the request to an api that isn't going anywhere, so using curl hadn't been a prob up until now. I'll check out HTTP_Request PEAR library though, thanks.
Re: Ahhh! no more cURL, what do I do?
Where did you get that from?You really don't want to depend too heavily on cURL for mission-critical stuff
For anything remotely complicated, definitely use cURL to generate your requests.
If you are using PHP5+ you can use the built in HttpRequest class - http://www.php.net/manual/en/class.httprequest.php
But if you need to generate complex requests, cURL is your only option
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Ahhh! no more cURL, what do I do?
You can always communicate through fsockopen() and send the headers yourselfpytrin wrote:Where did you get that from?You really don't want to depend too heavily on cURL for mission-critical stuff
For anything remotely complicated, definitely use cURL to generate your requests.
If you are using PHP5+ you can use the built in HttpRequest class - http://www.php.net/manual/en/class.httprequest.php
But if you need to generate complex requests, cURL is your only option
Re: Ahhh! no more cURL, what do I do?
I'd get a different host personally.
Re: Ahhh! no more cURL, what do I do?
RightYou can always communicate through fsockopen() and send the headers yourself
forgot about good old sockets..