B4J Question B4X Push server - curl cannot run from php

Discussion in 'B4J Questions' started by Shay, Feb 5, 2015.

  1. Shay

    Shay Well-Known Member Licensed User

    I adjusted the push server code
    if I send from command line (linux) the following:
    curl --request GET 'http://localhost:51044/send?password=11116&text="message to send"'
    it is working fine (the b4x server is responding)

    but if I do the same from php code, it is not getting anything (server log is blank)
    any idea why?
    Can I add more logs to understand what happening?

    on this script I am getting "0" (need to get 200 (for 200 ok)), while other pages on my apache is giving 200

    $dom_u = 
    ""; //username
    $dom_p = 
    ""; //password
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 
    curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 
    curl_setopt($ch, CURLOPT_BUFFERSIZE, 
    curl_setopt($ch, CURLOPT_USERAGENT, 
    "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
    curl_setopt($ch, CURLOPT_URL, 
    curl_setopt($ch, CURLOPT_USERPWD,$dom_u.
    $data = curl_exec($ch);
    $info = curl_getinfo($ch);
  2. Erel

    Erel Administrator Staff Member Licensed User

    What do you need the PHP for? Why not communicate with the push server directly?
  3. Shay

    Shay Well-Known Member Licensed User

    since the server will handle it not the user
    I am doing the same with the android
    Can you try the php code, ad curl and see why it is not working with php?
  4. Shay

    Shay Well-Known Member Licensed User

    I tried several ways to send http request (not just curl) none of them is working
    b4x is not getting anything
    if I do telnet IP:51044 from inside or outside the server, the port is responding, so this is not firewall issue

    I did manage to make it to work if I put b4x on port 80, but I cannot bind it to port 80, since my apache is on this port, any idea why this is happening?
  5. Shay

    Shay Well-Known Member Licensed User

    I manage to solve this
    basically I did many things so I am not sure this is the only change
    if someone have this issue and the below is not solving, let me know

    so I moved the default b4x port to port 81, and restart apache
    (but again this might be part of the solution)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice