Jump to content

PHP cURL Help Needed


mudgil.gaurav

Recommended Posts

Hi All,

 

I want to get all my bills from the following website

 

https://svclink.miworld.com.sg/ssonline/login/login.jsp?cat=account&link=viewbill&layer=lyr1&content=viewbill&errorcode=null&appurl=https%3A%2F%2Fsvclink.miworld.com.sg%2Fssonline%2Flogin%2Fgoto.jsp%3Fappid%3DANYPostAny%26urlPath%3Dhttps%253A%252F%252Fsvclink.miworld.com.sg%252Fssonline%252Faccount%252Fmiworld_account.jsp%26cat%3Daccount%26link%3Dviewbill%26layer%3Dlyr1%26content%3Dviewbill&sessStat=0

 

Can anybody suggest me how to send my mobile number , password, account number with the curl request so that i can get the required result.

 

Any help or suggestion would be greatly appriciated.

 

Thanks

Link to comment
Share on other sites

I don't think cURL is where you need to be looking.  You need to make a POST request to the website.

 

Example:

 

function makePost($url, $referer, $_data) {

    $data = array();   

    while(list($n,$v) = each($_data)){

        $data[] = "$n=$v";

    }    

    $data = implode('&', $data);

    $url = parse_url($url);

    if ($url['scheme'] != 'http') { 

        die('Only HTTP request are supported !');

    }

    $host = $url['host'];
    $path = $url['path'];

    //CREATE A SOCKET
    $fp = fsockopen($host, 80);

    //HEADERS
    fputs($fp, "POST $path HTTP/1.1\r\n");
    fputs($fp, "Host: $host\r\n");
    fputs($fp, "Referer: $referer\r\n");
    fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
    fputs($fp, "Content-length: ". strlen($data) ."\r\n");
    fputs($fp, "Connection: close\r\n\r\n");
    fputs($fp, $data);

    $result = ''; 

    while(!feof($fp)) {

        $result .= fgets($fp, 128);
    }

    fclose($fp);

    $result = explode("\r\n\r\n", $result, 2);

    $header = isset($result[0]) ? $result[0] : '';

    $content = isset($result[1]) ? $result[1] : '';

    return array($header, $content);
}


$data = array(
    'field1' => 'value1',
    'field2' => 'value2',
    'field3' => 'value3'
);

list($header, $content) = makePost("http://www.example.com/", "http://www.referersite.com/", $data);

print $content;

Link to comment
Share on other sites

I don't think cURL is where you need to be looking.  You need to make a POST request to the website.

cURL can make any request and is much more efficient that any other method. Essentially cURL is a web browser for php.

 

You need the exact field/parameter names to make a POST or GET request. You may need to login to the website via cURL and set a session / cookie (fopen / fputs / fsockopen cannot do this so you would never authenticate to the remote site).

 

Please post the code you have.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.