mercredi 23 septembre 2015

cURL returning empty string

Hey am I missing a curl_opt or something? This code was working yesterday and now it doesnt work. It is suppose to return a json string but instead returns empty string.

<?php
session_start();

$UCID=$_POST['UCID'];
$Pass=$_POST['Pass'];
$credentials=array("Username"=>$UCID, "Password"=>$Pass);
$post_field_string = http_build_query($credentials, '', '&');






$url1="http://ift.tt/1OpBZx9";
//$url1="http://ift.tt/1JkFBIO";
$ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, $url1);
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt ($ch, CURLOPT_REFERER, $url1);
    curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_field_string);
    curl_setopt ($ch, CURLOPT_POST, true);
    $result = curl_exec($ch);
    curl_close($ch);
    $json=json_decode($result);
    echo $json->result;
?>




Aucun commentaire:

Enregistrer un commentaire