Web Hosting Talk







View Full Version : Require CURL PHP Help [EASY]


[IG]Chris
07-13-2006, 08:32 PM
Hello,
I have created a script using file() however dreamhost do not allow the use of this function so I have to recode it using CURL, the only issue is that I do not know how to use curl.

This is the code:

<?php



// my user details
$username = "username";
$password = "password";
$path = "/sms/postmsg.php";
$conncted = FALSE;
$message = "Welcome! Bla Bla Bla";
$number = "************";

// encodes your message for sending on the web
$message = urlencode($message);

// the request string
$smsurl = "$path?username=$username&password=$password&to_num=$number&message=$message";



// connects to server to send message

$array_servers = array("gw2.aql.com","gw22.aql.com");
foreach($array_servers as $server)
{
$connecturl = "http://$server".$smsurl;
if($content_array = file($connecturl))
{
$connected = TRUE;

$content = implode("", $content_array);
// check for response
if (eregi("AQSMS-AUTHERROR",$content))
echo "There was an authenication error";
elseif (eregi("AQSMS-NOMSG",$content))
echo "There was no message or mobile number";
elseif (eregi("AQSMS-OK",$content))
echo "The Message was queued succcessfully";
elseif (eregi("AQSMS-NOCREDIT",$content))
echo "Your account has no credit";
break;

}

}

if($connected ==FALSE)
{



echo "There was an error connecting to the server";
}







?>

Now the code works because I have tested it on a server where the function is good, but I need to run it on dreamhost one.

Can someone please provide me with help so I can get it working with CURL

Thanks

NickDev
07-13-2006, 08:44 PM
www.php.net/curl

[IG]Chris
07-13-2006, 09:16 PM
I have read the docuemntation and cant understand it.

Can anyone with good knowledge of it advise.

[IG]Chris
07-14-2006, 05:49 AM
Im still trying, does anyone know anything that could help me??

Really in desparate need and I cant get it working

[IG]Chris
07-14-2006, 09:05 AM
Just so everyone knows the issue is resolved.