Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8789267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:21:29+00:00 2026-06-13T22:21:29+00:00

I am trying to do HTTPRequest Post via Google App Engine. This is what

  • 0

I am trying to do HTTPRequest Post via Google App Engine.
This is what I have so far

URL url = new URL("http://myurl.com/myfile.php");
HTTPRequest request = new HTTPRequest(url, HTTPMethod.POST);
request.setPayload(########);
HTTPResponse response = URLFetchServiceFactory.getURLFetchService().fetch(request);

Here I need to put some paired values (ie. “email”,”hi@example.com” etc)
Since setPayload accept byte[] I have no idea how to convert my paired values
into byte.

I have searched other posts but I am very stuck.

EDIT:
I have changed to this but it is still not working

byte[] data = ("EMAIL=bo0@gmail.com&TITLE=evolution&COMMENT=comments&PRICE=5000;").getBytes();
try {
URL url = new URL("http://www.bo.x10.mx/nPost.php");
HTTPRequest request = new HTTPRequest(url, HTTPMethod.POST);
request.setPayload(data);
HTTPResponse response = URLFetchServiceFactory.getURLFetchService().fetch(request);

This is what I have on php website.

<?php
include "path/conf.php"; //logging into database works
$tb_name = 'Post';
$EMAIL=$_POST['EMAIL'];
$TITLE =$_POST['TITLE'];
$COMMENT =$_POST['COMMENT'];
$PRICE =$_POST['PRICE'];
if(!isset($EMAIL) || !isset($TITLE ) || !isset($PRICE )|| !isset($COMMENT)){
header('HTTP/1.0 412 Precondition Failed', true, 412);
die('Bad data');
}
$sql="INSERT INTO $tb_name(EMAIL, TITLE, COMMENT, PRICE) VALUES ('$EMAIL', '$TITLE ', '$COMMENT ', '$PRICE ')";
$result=mysql_query($sql);
if($result==TRUE){
echo "successfully inserted into table!";}
else{
echo "error in inserting into table!";
header('HTTP/1.0 500 Internal Server Error', true, 500);}
ob_end_flush();
exit();
?>

EDIT2: This is a working code

try{
byte[] data = ("EMAIL=bo0@gmail.com&TITLE=evolution&COMMENT=comments&PRICE=5000").getBytes("UTF-8");
URL url = new URL("http://www.box.com/nost.php");
HTTPRequest request = new HTTPRequest(url, HTTPMethod.POST);
request.setPayload(data);
HTTPResponse response = URLFetchServiceFactory.getURLFetchService().fetch(request);
}

My database string field is of type UTF-8

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:21:30+00:00Added an answer on June 13, 2026 at 10:21 pm

    You create a String with the request body, and then you get the byte array. For example we have:

    URL url = new URL("http://myurl.com/myfile.php");
    HTTPRequest request = new HTTPRequest(url, HTTPMethod.POST);
    String body = "email=" + email + "&mpla=" + mpla;
    request.setPayload(body.getBytes("UTF-8"));
    HTTPResponse response = URLFetchServiceFactory.getURLFetchService().fetch(request);
    

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get an HttpRequest to post this URL https://www.iformbuilder.com/exzact/_emptyTable.php?PAGE_ID=1234&TABLE_NAME=table_name_here&USERNAME=yo@yo.com&PASSWORD=What!What ! I've tried
I have used URLFetch class to do HTTP Post in Google App engine to
I am trying to connect with google via oauth V2 I make http request
I'm trying to POST a http request using ajax, but getting a response from
I'm trying to upload a file using JavaFX using the HttpRequest. For this purpose
I'm trying to implement a simple HTTP server in Android that handles POST requests,
I'm trying to add a referer to an http post in Apache HttpClient (httpclient-4.0-beta2).
This is part of a android app... I have the php script working when
I'm trying to write a hard-coded HTTP Post request with SOAP action, using the
Trying to simulate a HTTP POST that needs to combine some INPUT/TEXT fields along

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.