Any experience with PHP and CURL??

Discussion about Schedules Direct grabber code and data formats.

Any experience with PHP and CURL??

Postby zbethem » Thu Feb 07, 2008 1:05 pm

I'm trying to retrieve TV listings for processing by my program in PHP. I at first tried using the nusoap_client, but returned to using CURL. Here's my code:

Code: Select all
$entry =<<<_XML_
       <SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:SOAP-ENC="" xmlns:xsi="" xmlns:xsd="">
          <m:download xmlns:m="urn:TMSWebServices" SOAP-ENV:encodingStyle="">
             <startTime xsi:type="xsd:dateTime">2008-02-10T19:00:00Z</startTime>
             <endTime xsi:type="xsd:dateTime">2008-02-10T21:00:00Z</endTime>

$curl = curl_init("");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 * ignore SSL Cert verification unless curl is setup to handle
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($curl, CURLOPT_POSTFIELDS, $entry);
curl_setopt($curl, CURLOPT_USERPWD, $user.':'.$password);
curl_setopt($curl, CURLOPT_FRESH_CONNECT,true);

echo '<h2>Curl Results:</h2>';
print curl_exec($curl);
echo '<br><h2>Curl Error:</h2>';
print curl_error($curl);
print curl_close($curl);

This seems to get me somewhere, but the response is simply repeating documentation tags in the WSDL. Is my endpoint not correct? Thanks in advance.

Result of above:
A collection of messages that may be sent back by the server to the client. Messages are usually used by the server to notify the user of changes to their subscription caused by automatic changes in station's that are part of their subscription. For instance, messages are passed back if a lineup selected by the user is no-longer valid, if all the stations selected by the user has been removed as they are no longer valid ... An individual message that is passed back by the server. The time (in UTC) until which download requests will be blocked by the webservice. The time (in UTC) at which the webservice recommends that the client attempt another download request. A general success message to indicate a successful transaction. In general failures will result in SOAP Faults.
Posts: 2
Joined: Thu Feb 07, 2008 12:55 pm

Re: Any experience with PHP and CURL??

Postby rmeden » Thu Feb 07, 2008 2:52 pm

I have a monitor script that is in PHP. I do this
Code: Select all
        $data_url   ='';
        $stop =gmdate("Y-m-d\TH:i:s\Z",time()+30);
        $client = new SoapClient($data_url, array('exceptions' => 0,
                                                  'login'      => $username,
                                                  'password'   => $password));
        $data = $client->download($start,$stop);
SD Board Member
Posts: 1497
Joined: Tue Aug 14, 2007 2:31 pm
Location: Cedar Hill, TX

Re: Any experience with PHP and CURL??

Postby zbethem » Thu Feb 07, 2008 3:10 pm

Dude, that's perfect!!!!! So happy now. Now I can move on to digesting the return array.

Thanks so much.
Posts: 2
Joined: Thu Feb 07, 2008 12:55 pm

Return to Developers Corner

Who is online

Users browsing this forum: No registered users and 5 guests